summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-06-23 10:41:10 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-06-23 10:41:10 +0200
commitd9a8e282e561004ff318b5db14f3c026c5c6ddec (patch)
treee1537a38eb3c75a7c9074d18a8762ee16832c1ad
parent95f4ddd4e5ce8f8816bd7206426337ce7f1e4f98 (diff)
downloadvdr-d9a8e282e561004ff318b5db14f3c026c5c6ddec.tar.gz
vdr-d9a8e282e561004ff318b5db14f3c026c5c6ddec.tar.bz2
Fonts can now be created with a width that overwrites the default width
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY2
-rw-r--r--font.c12
-rw-r--r--font.h7
4 files changed, 13 insertions, 9 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index d68b0fa9..f70d8ba1 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -939,6 +939,7 @@ Andreas Mair <Andreas.Mair@linogate.com>
is started through a user defined key macro
for reporting a problem with extremely long summary fields in timers
for reporting a bug in handling the tfRecording flag when reading timers
+ for enabling fonts to be created with a width that overwrites the default width
Olivier Jacques <jacquesolivier@hotmail.com>)
for translating OSD texts to the French language
diff --git a/HISTORY b/HISTORY
index b9cedb81..aeb517ad 100644
--- a/HISTORY
+++ b/HISTORY
@@ -5267,3 +5267,5 @@ Video Disk Recorder Revision History
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Changed the parameter "OSD font size" to "Default font size" in "Setup/OSD".
- Fixed handling address masks in SVDRP host settings (thanks to Frank Schmirler).
+- Fonts can now be created with a width that overwrites the default width (thanks
+ to Andreas Mair).
diff --git a/font.c b/font.c
index 7e47e7ac..aeaa1da7 100644
--- a/font.c
+++ b/font.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: font.c 1.19 2007/06/17 12:13:49 kls Exp $
+ * $Id: font.c 1.20 2007/06/23 10:41:10 kls Exp $
*/
#include "font.h"
@@ -103,7 +103,7 @@ private:
int Kerning(cGlyph *Glyph, uint PrevSym) const;
cGlyph* Glyph(uint CharCode, bool AntiAliased = false) const;
public:
- cFreetypeFont(const char *Name, int CharHeight);
+ cFreetypeFont(const char *Name, int CharHeight, int CharWidth = 0);
virtual ~cFreetypeFont();
virtual int Width(uint c) const;
virtual int Width(const char *s) const;
@@ -111,7 +111,7 @@ public:
virtual void DrawText(cBitmap *Bitmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const;
};
-cFreetypeFont::cFreetypeFont(const char *Name, int CharHeight)
+cFreetypeFont::cFreetypeFont(const char *Name, int CharHeight, int CharWidth)
{
height = 0;
bottom = 0;
@@ -140,7 +140,7 @@ cFreetypeFont::cFreetypeFont(const char *Name, int CharHeight)
}
else {
error = FT_Set_Char_Size(face, // handle to face object
- 0, // char_width in 1/64th of points
+ CharWidth * 64, // CharWidth in 1/64th of points
CharHeight * 64, // CharHeight in 1/64th of points
0, // horizontal device resolution
0); // vertical device resolution
@@ -332,11 +332,11 @@ const cFont *cFont::GetFont(eDvbFont Font)
return fonts[Font];
}
-cFont *cFont::CreateFont(const char *Name, int CharHeight)
+cFont *cFont::CreateFont(const char *Name, int CharHeight, int CharWidth)
{
cString fn = GetFontFileName(Name);
if (*fn)
- return new cFreetypeFont(fn, CharHeight);
+ return new cFreetypeFont(fn, CharHeight, CharWidth);
return NULL;
}
diff --git a/font.h b/font.h
index 4a83c873..4794304a 100644
--- a/font.h
+++ b/font.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: font.h 1.19 2007/06/17 12:11:31 kls Exp $
+ * $Id: font.h 1.20 2007/06/23 10:09:14 kls Exp $
*/
#ifndef __FONT_H
@@ -57,9 +57,10 @@ public:
///< The caller must not use the returned font outside the scope in which
///< it was retrieved by the call to GetFont(), because a call to SetFont()
///< may delete an existing font.
- static cFont *CreateFont(const char *Name, int CharHeight);
+ static cFont *CreateFont(const char *Name, int CharHeight, int CharWidth = 0);
///< Creates a new font object with the given Name and makes its characters
- ///< CharHeight pixels high. Name is of the form "Family:Style", for instance
+ ///< CharHeight pixels high. If CharWidth is given, it overwrites the font's
+ ///< default width. Name is of the form "Family:Style", for instance
///< "Verdana:Bold Italic" or "Times New Roman". See GetAvailableFontNames()
///< for how to get a list of all available font names.
///< If the requested font can't be created, NULL is returned.