r=mkaply, a=blizzard
Quick fix to enable DBCS fonts git-svn-id: svn://10.0.0.236/trunk@80833 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
a4deacb317
commit
86d0aa8cc8
@ -358,34 +358,76 @@ nsresult GetSysFontInfo(nsSystemAttrID anID, nsFont* aFont)
|
||||
switch (anID)
|
||||
{
|
||||
case eSystemAttr_Font_Caption:
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText", gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
if (!IsDBCS) {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText",
|
||||
gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} else {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText",
|
||||
gIsWarp4 ? "9.WarpSans Combined" : "8.Helv Combined",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} /* endif */
|
||||
break;
|
||||
|
||||
case eSystemAttr_Font_Icon:
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "IconText", gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
if (!IsDBCS) {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "IconText",
|
||||
gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} else {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "IconText",
|
||||
gIsWarp4 ? "9.WarpSans Combined" : "8.Helv Combined",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} /* endif */
|
||||
break;
|
||||
|
||||
case eSystemAttr_Font_Menu:
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "Menus", gIsWarp4 ? "9.WarpSans Bold" : "10.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
if (!IsDBCS) {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "Menus",
|
||||
gIsWarp4 ? "9.WarpSans Bold" : "10.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} else {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "Menus",
|
||||
gIsWarp4 ? "9.WarpSans Combined" : "10.Helv Combined",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} /* endif */
|
||||
break;
|
||||
|
||||
case eSystemAttr_Font_MessageBox:
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText", gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
if (!IsDBCS) {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText",
|
||||
gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} else {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText",
|
||||
gIsWarp4 ? "9.WarpSans Combined" : "8.Helv Combined",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} /* endif */
|
||||
break;
|
||||
|
||||
case eSystemAttr_Font_SmallCaption:
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText", gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
if (!IsDBCS) {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText",
|
||||
gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} else {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText",
|
||||
gIsWarp4 ? "9.WarpSans Combined" : "8.Helv Combined",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} /* endif */
|
||||
break;
|
||||
|
||||
case eSystemAttr_Font_StatusBar:
|
||||
case eSystemAttr_Font_Tooltips:
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText", gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
if (!IsDBCS) {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText",
|
||||
gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} else {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText",
|
||||
gIsWarp4 ? "9.WarpSans Combined" : "8.Helv Combined",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} /* endif */
|
||||
break;
|
||||
|
||||
case eSystemAttr_Font_Widget:
|
||||
@ -400,8 +442,15 @@ nsresult GetSysFontInfo(nsSystemAttrID anID, nsFont* aFont)
|
||||
case eSystemAttr_Font_PullDownMenu:
|
||||
case eSystemAttr_Font_List:
|
||||
case eSystemAttr_Font_Field:
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText", gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
if (!IsDBCS) {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText",
|
||||
gIsWarp4 ? "9.WarpSans" : "8.Helv",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} else {
|
||||
PrfQueryProfileString(HINI_USER, "PM_SystemFonts", "WindowText",
|
||||
gIsWarp4 ? "9.WarpSans Combined" : "8.Helv Combined",
|
||||
szFontNameSize, MAXNAMEL);
|
||||
} /* endif */
|
||||
break;
|
||||
} // switch
|
||||
|
||||
|
||||
@ -290,6 +290,23 @@ static nsFontFamilyName gFamilyNameTable[] =
|
||||
{ nsnull, nsnull }
|
||||
};
|
||||
|
||||
static nsFontFamilyName gFamilyNameTableDBCS[] =
|
||||
{
|
||||
#ifdef MOZ_MATHML
|
||||
{ "-moz-math-text", "Times New Roman" },
|
||||
{ "-moz-math-symbol", "Symbol" },
|
||||
#endif
|
||||
{ "times", "Times New Roman" },
|
||||
{ "times roman", "Times New Roman" },
|
||||
{ "times new roman", "Times New Roman" },
|
||||
{ "arial", "Arial" },
|
||||
{ "helvetica", "Helv Combined" },
|
||||
{ "courier", "Courier" },
|
||||
{ "courier new", "Courier New" },
|
||||
|
||||
{ nsnull, nsnull }
|
||||
};
|
||||
|
||||
PLHashTable*
|
||||
nsFontMetricsOS2::InitializeFamilyNames(void)
|
||||
{
|
||||
@ -301,7 +318,12 @@ nsFontMetricsOS2::InitializeFamilyNames(void)
|
||||
if (!gFamilyNames) {
|
||||
return nsnull;
|
||||
}
|
||||
nsFontFamilyName* f = gFamilyNameTable;
|
||||
nsFontFamilyName* f;
|
||||
if (!IsDBCS()) {
|
||||
f = gFamilyNameTableDBCS;
|
||||
} else {
|
||||
f = gFamilyNameTableDBCS;
|
||||
} /* endif */
|
||||
while (f->mName) {
|
||||
nsString* name = new nsString;
|
||||
nsString* winName = new nsString;
|
||||
|
||||
@ -81,6 +81,8 @@ struct nsGfxModuleData
|
||||
|
||||
int WideCharToMultiByte( int CodePage, const PRUnichar *pText, ULONG ulLength, char* szBuffer, ULONG ulSize );
|
||||
|
||||
BOOL IsDBCS();
|
||||
|
||||
extern nsGfxModuleData gModuleData;
|
||||
|
||||
#ifndef min
|
||||
|
||||
@ -67,6 +67,7 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kCScriptableRegion, NS_SCRIPTABLE_REGION_CID);
|
||||
|
||||
static BOOL bIsDBCS;
|
||||
|
||||
class nsGfxFactoryOS2 : public nsIFactory
|
||||
{
|
||||
@ -101,6 +102,31 @@ nsGfxFactoryOS2::nsGfxFactoryOS2(const nsCID &aClass)
|
||||
*/
|
||||
}
|
||||
|
||||
// the following lines of code determine whether the system is a DBCS country
|
||||
APIRET rc;
|
||||
COUNTRYCODE ctrycodeInfo = {0};
|
||||
CHAR achDBCSInfo[12] = {0}; // DBCS environmental vector
|
||||
ctrycodeInfo.country = 0; // current country
|
||||
ctrycodeInfo.codepage = 0; // current codepage
|
||||
|
||||
rc = DosQueryDBCSEnv(sizeof(achDBCSInfo), &ctrycodeInfo, achDBCSInfo);
|
||||
if (rc == NO_ERROR)
|
||||
{
|
||||
// NON-DBCS countries will have four bytes in the first four bytes of the
|
||||
// DBCS environmental vector
|
||||
if (achDBCSInfo[0] != 0 || achDBCSInfo[1] != 0 ||
|
||||
achDBCSInfo[2] != 0 || achDBCSInfo[3] != 0)
|
||||
{
|
||||
bIsDBCS = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bIsDBCS = FALSE;
|
||||
}
|
||||
} else {
|
||||
bIsDBCS = FALSE;
|
||||
} /* endif */
|
||||
|
||||
NS_INIT_REFCNT();
|
||||
mClassID = aClass;
|
||||
}
|
||||
@ -304,6 +330,8 @@ void nsGfxModuleData::Init()
|
||||
hpsScreen = WinGetScreenPS( HWND_DESKTOP);
|
||||
HDC hdc = GpiQueryDevice( hpsScreen);
|
||||
DevQueryCaps( hdc, CAPS_COLOR_BITCOUNT, 1, &lDisplayDepth);
|
||||
|
||||
|
||||
}
|
||||
|
||||
nsGfxModuleData::~nsGfxModuleData()
|
||||
@ -364,3 +392,8 @@ int WideCharToMultiByte( int CodePage, const PRUnichar *pText, ULONG ulLength, c
|
||||
}
|
||||
return ulSize - cplen;
|
||||
}
|
||||
|
||||
BOOL IsDBCS()
|
||||
{
|
||||
return bIsDBCS;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user