mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Draw Win32: Minor font fixes
git-svn-id: svn://ultimatepp.org/upp/trunk@1396 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
1276dbc3ff
commit
5920ddb546
3 changed files with 38 additions and 24 deletions
|
|
@ -68,7 +68,7 @@ public:
|
|||
enum {
|
||||
FIXEDPITCH = 0x0001,
|
||||
SCALEABLE = 0x0002,
|
||||
LOCAL = 0x0010,
|
||||
SPECIAL = 0x0010,
|
||||
};
|
||||
|
||||
static int GetFaceCount();
|
||||
|
|
@ -161,6 +161,8 @@ public:
|
|||
int GetRightSpace(int c) const;
|
||||
bool IsFixedPitch() const { return Fi().fixedpitch; }
|
||||
bool IsScaleable() const { return Fi().scaleable; }
|
||||
bool IsSpecial() const { return !(GetFaceInfo() & SPECIAL); }
|
||||
|
||||
#ifdef PLATFORM_POSIX
|
||||
String GetPath() const { return Fi().path; }
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ CommonFontInfo GetFontInfoSys(Font font)
|
|||
return fi;
|
||||
}
|
||||
|
||||
static Vector<FaceInfo> *sList;
|
||||
static VectorMap<String, FaceInfo> *sList;
|
||||
|
||||
static int CALLBACK Win32_AddFace(const LOGFONT *logfont, const TEXTMETRIC *, dword type, LPARAM param)
|
||||
{
|
||||
|
|
@ -161,22 +161,34 @@ static int CALLBACK Win32_AddFace(const LOGFONT *logfont, const TEXTMETRIC *, dw
|
|||
if(facename && stricmp(logfont->lfFaceName, facename))
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
dword typ = 0;
|
||||
if((logfont->lfPitchAndFamily & 3) == FIXED_PITCH)
|
||||
typ |= Font::FIXEDPITCH;
|
||||
if(type & TRUETYPE_FONTTYPE)
|
||||
typ |= Font::SCALEABLE;
|
||||
if(!(logfont->lfCharSet == SYMBOL_CHARSET) && logfont->lfCharSet != 0)
|
||||
typ |= Font::LOCAL;
|
||||
if(logfont->lfFaceName[0] == '@')
|
||||
return 0;
|
||||
|
||||
#ifdef PLATFORM_WINCE
|
||||
FontFaceInfo& f = sFontFace().Add(WString(logfont->lfFaceName).ToString());
|
||||
FontFaceInfo& f = sFontFace().GetAdd(WString(logfont->lfFaceName).ToString());
|
||||
f.name = FromSystemCharset(logfont->lfFaceName);
|
||||
#else
|
||||
FaceInfo& f = sList->Add();
|
||||
String name = FromSystemCharset(logfont->lfFaceName);
|
||||
|
||||
if(FindIndex(Split("Courier New CE;Courier New CYR;Courier New Greek;"
|
||||
"Courier New TUR;Courier New Baltic;Arial CE;Arial CYR;"
|
||||
"Arial Greek;Arial TUR;Arial Baltic;Arial CE;Times New Roman CE;"
|
||||
"Times New Roman CYR;Times New Roman Greek;Times New Roman TUR;"
|
||||
"Times New Roman Baltic;Times New Roman CE", ';'), name) >= 0)
|
||||
return 1;
|
||||
|
||||
int q = sList->Find(name);
|
||||
FaceInfo& f = q < 0 ? sList->Add(logfont->lfFaceName) : (*sList)[q];
|
||||
f.name = FromSystemCharset(logfont->lfFaceName);
|
||||
f.info = typ;
|
||||
#endif
|
||||
if(q < 0)
|
||||
f.info = Font::SCALEABLE;
|
||||
if((logfont->lfPitchAndFamily & 3) == FIXED_PITCH)
|
||||
f.info |= Font::FIXEDPITCH;
|
||||
if(!(type & TRUETYPE_FONTTYPE))
|
||||
f.info &= ~Font::SCALEABLE;
|
||||
if(logfont->lfCharSet == SYMBOL_CHARSET || logfont->lfCharSet == OEM_CHARSET)
|
||||
f.info |= Font::SPECIAL;
|
||||
return facename ? 0 : 1;
|
||||
}
|
||||
|
||||
|
|
@ -199,9 +211,9 @@ static void Win32_ForceFace(HDC hdc, const char *face, const char *aface)
|
|||
|
||||
Vector<FaceInfo> GetAllFacesSys()
|
||||
{
|
||||
Vector<FaceInfo> list;
|
||||
VectorMap<String, FaceInfo> list;
|
||||
sList = &list;
|
||||
list.Add().name = "STDFONT";
|
||||
list.Add("STDFONT").name = "STDFONT";
|
||||
list.Top().info = 0;
|
||||
#ifdef PLATFORM_WINCE
|
||||
HDC hdc = CreateDC(NULL, NULL, NULL, NULL);
|
||||
|
|
@ -222,7 +234,7 @@ Vector<FaceInfo> GetAllFacesSys()
|
|||
#endif
|
||||
Win32_EnumFace(hdc, NULL);
|
||||
DeleteDC(hdc);
|
||||
return list;
|
||||
return list.PickValues();
|
||||
}
|
||||
|
||||
#define GLYPHINFOCACHE 31
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ TOPIC("PackageTemplates$en-us")
|
|||
#include "PackageTemplates$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
||||
TOPIC("About$en-us")
|
||||
#include "About$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
||||
TOPIC("esc$en-us")
|
||||
#include "esc$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
|
@ -58,6 +62,10 @@ TOPIC("Sponsor$en-us")
|
|||
#include "Sponsor$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
||||
TOPIC("install$en-us")
|
||||
#include "install$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
||||
TOPIC("BSD$en-us")
|
||||
#include "BSD$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
|
@ -86,11 +94,3 @@ TOPIC("Blitz$en-us")
|
|||
#include "Blitz$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
||||
TOPIC("install$en-us")
|
||||
#include "install$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
||||
TOPIC("About$en-us")
|
||||
#include "About$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue