mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 17:16:43 +00:00
[WIN32SS] Fix font names not including style info (Bold etc). Patch by Katayama Hirofumi MZ. CORE-12179 #comment Thanks!
svn path=/trunk/; revision=74499
This commit is contained in:
parent
8600730e9c
commit
5c8991ddbd
1 changed files with 61 additions and 63 deletions
|
@ -1738,6 +1738,10 @@ FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI,
|
||||||
FillTMEx(TM, FontGDI, pOS2, pHori, pFNT, FALSE);
|
FillTMEx(TM, FontGDI, pOS2, pHori, pFNT, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
IntGetFontLocalizedName(PUNICODE_STRING pNameW, FT_Face Face,
|
||||||
|
FT_UShort NameID, FT_UShort LangID);
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
* IntGetOutlineTextMetrics
|
* IntGetOutlineTextMetrics
|
||||||
*
|
*
|
||||||
|
@ -1752,57 +1756,40 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI,
|
||||||
TT_HoriHeader *pHori;
|
TT_HoriHeader *pHori;
|
||||||
TT_Postscript *pPost;
|
TT_Postscript *pPost;
|
||||||
FT_Fixed XScale, YScale;
|
FT_Fixed XScale, YScale;
|
||||||
ANSI_STRING FamilyNameA, StyleNameA;
|
|
||||||
UNICODE_STRING FamilyNameW, StyleNameW, Regular;
|
|
||||||
FT_WinFNT_HeaderRec Win;
|
FT_WinFNT_HeaderRec Win;
|
||||||
FT_Error Error;
|
FT_Error Error;
|
||||||
char *Cp;
|
char *Cp;
|
||||||
NTSTATUS status;
|
|
||||||
FT_Face Face = FontGDI->SharedFace->Face;
|
FT_Face Face = FontGDI->SharedFace->Face;
|
||||||
|
UNICODE_STRING FamilyNameW, FaceNameW, StyleNameW, FullNameW;
|
||||||
|
|
||||||
|
/* family name */
|
||||||
|
RtlInitUnicodeString(&FamilyNameW, NULL);
|
||||||
|
IntGetFontLocalizedName(&FamilyNameW, Face, TT_NAME_ID_FONT_FAMILY, gusLanguageID);
|
||||||
|
|
||||||
|
/* face name */
|
||||||
|
RtlInitUnicodeString(&FaceNameW, NULL);
|
||||||
|
IntGetFontLocalizedName(&FaceNameW, Face, TT_NAME_ID_FULL_NAME, gusLanguageID);
|
||||||
|
|
||||||
|
/* style name */
|
||||||
|
RtlInitUnicodeString(&StyleNameW, NULL);
|
||||||
|
IntGetFontLocalizedName(&StyleNameW, Face, TT_NAME_ID_FONT_SUBFAMILY, gusLanguageID);
|
||||||
|
|
||||||
|
/* unique name (full name) */
|
||||||
|
RtlInitUnicodeString(&FullNameW, NULL);
|
||||||
|
IntGetFontLocalizedName(&FullNameW, Face, TT_NAME_ID_UNIQUE_ID, gusLanguageID);
|
||||||
|
|
||||||
Needed = sizeof(OUTLINETEXTMETRICW);
|
Needed = sizeof(OUTLINETEXTMETRICW);
|
||||||
|
|
||||||
RtlInitAnsiString(&FamilyNameA, Face->family_name);
|
|
||||||
status = RtlAnsiStringToUnicodeString(&FamilyNameW, &FamilyNameA, TRUE);
|
|
||||||
if (!NT_SUCCESS(status))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlInitAnsiString(&StyleNameA, Face->style_name);
|
|
||||||
status = RtlAnsiStringToUnicodeString(&StyleNameW, &StyleNameA, TRUE);
|
|
||||||
if (!NT_SUCCESS(status))
|
|
||||||
{
|
|
||||||
RtlFreeUnicodeString(&FamilyNameW);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* These names should be read from the TT name table */
|
|
||||||
|
|
||||||
/* Length of otmpFamilyName */
|
|
||||||
Needed += FamilyNameW.Length + sizeof(WCHAR);
|
Needed += FamilyNameW.Length + sizeof(WCHAR);
|
||||||
|
Needed += FaceNameW.Length + sizeof(WCHAR);
|
||||||
RtlInitUnicodeString(&Regular, L"Regular");
|
|
||||||
/* Length of otmpFaceName */
|
|
||||||
if (RtlEqualUnicodeString(&StyleNameW, &Regular, TRUE))
|
|
||||||
{
|
|
||||||
Needed += FamilyNameW.Length + sizeof(WCHAR); /* Just the family name */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Needed += FamilyNameW.Length + StyleNameW.Length + (sizeof(WCHAR) << 1); /* family + " " + style */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Length of otmpStyleName */
|
|
||||||
Needed += StyleNameW.Length + sizeof(WCHAR);
|
Needed += StyleNameW.Length + sizeof(WCHAR);
|
||||||
|
Needed += FullNameW.Length + sizeof(WCHAR);
|
||||||
/* Length of otmpFullName */
|
|
||||||
Needed += FamilyNameW.Length + StyleNameW.Length + (sizeof(WCHAR) << 1);
|
|
||||||
|
|
||||||
if (Size < Needed)
|
if (Size < Needed)
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&FamilyNameW);
|
RtlFreeUnicodeString(&FamilyNameW);
|
||||||
|
RtlFreeUnicodeString(&FaceNameW);
|
||||||
RtlFreeUnicodeString(&StyleNameW);
|
RtlFreeUnicodeString(&StyleNameW);
|
||||||
|
RtlFreeUnicodeString(&FullNameW);
|
||||||
return Needed;
|
return Needed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1815,8 +1802,10 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI,
|
||||||
{
|
{
|
||||||
IntUnLockFreeType;
|
IntUnLockFreeType;
|
||||||
DPRINT1("Can't find OS/2 table - not TT font?\n");
|
DPRINT1("Can't find OS/2 table - not TT font?\n");
|
||||||
RtlFreeUnicodeString(&StyleNameW);
|
|
||||||
RtlFreeUnicodeString(&FamilyNameW);
|
RtlFreeUnicodeString(&FamilyNameW);
|
||||||
|
RtlFreeUnicodeString(&FaceNameW);
|
||||||
|
RtlFreeUnicodeString(&StyleNameW);
|
||||||
|
RtlFreeUnicodeString(&FullNameW);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1825,8 +1814,10 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI,
|
||||||
{
|
{
|
||||||
IntUnLockFreeType;
|
IntUnLockFreeType;
|
||||||
DPRINT1("Can't find HHEA table - not TT font?\n");
|
DPRINT1("Can't find HHEA table - not TT font?\n");
|
||||||
RtlFreeUnicodeString(&StyleNameW);
|
|
||||||
RtlFreeUnicodeString(&FamilyNameW);
|
RtlFreeUnicodeString(&FamilyNameW);
|
||||||
|
RtlFreeUnicodeString(&FaceNameW);
|
||||||
|
RtlFreeUnicodeString(&StyleNameW);
|
||||||
|
RtlFreeUnicodeString(&FullNameW);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1882,33 +1873,34 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI,
|
||||||
|
|
||||||
IntUnLockFreeType;
|
IntUnLockFreeType;
|
||||||
|
|
||||||
/* otmp* members should clearly have type ptrdiff_t, but M$ knows best */
|
|
||||||
Cp = (char*) Otm + sizeof(OUTLINETEXTMETRICW);
|
Cp = (char*) Otm + sizeof(OUTLINETEXTMETRICW);
|
||||||
|
|
||||||
|
/* family name */
|
||||||
Otm->otmpFamilyName = (LPSTR)(Cp - (char*) Otm);
|
Otm->otmpFamilyName = (LPSTR)(Cp - (char*) Otm);
|
||||||
wcscpy((WCHAR*) Cp, FamilyNameW.Buffer);
|
wcscpy((WCHAR*) Cp, FamilyNameW.Buffer);
|
||||||
Cp += FamilyNameW.Length + sizeof(WCHAR);
|
Cp += FamilyNameW.Length + sizeof(WCHAR);
|
||||||
|
|
||||||
|
/* face name */
|
||||||
|
Otm->otmpFaceName = (LPSTR)(Cp - (char*) Otm);
|
||||||
|
wcscpy((WCHAR*) Cp, FaceNameW.Buffer);
|
||||||
|
Cp += FaceNameW.Length + sizeof(WCHAR);
|
||||||
|
|
||||||
|
/* style name */
|
||||||
Otm->otmpStyleName = (LPSTR)(Cp - (char*) Otm);
|
Otm->otmpStyleName = (LPSTR)(Cp - (char*) Otm);
|
||||||
wcscpy((WCHAR*) Cp, StyleNameW.Buffer);
|
wcscpy((WCHAR*) Cp, StyleNameW.Buffer);
|
||||||
Cp += StyleNameW.Length + sizeof(WCHAR);
|
Cp += StyleNameW.Length + sizeof(WCHAR);
|
||||||
Otm->otmpFaceName = (LPSTR)(Cp - (char*) Otm);
|
|
||||||
wcscpy((WCHAR*) Cp, FamilyNameW.Buffer);
|
|
||||||
if (!RtlEqualUnicodeString(&StyleNameW, &Regular, TRUE))
|
|
||||||
{
|
|
||||||
wcscat((WCHAR*) Cp, L" ");
|
|
||||||
wcscat((WCHAR*) Cp, StyleNameW.Buffer);
|
|
||||||
Cp += FamilyNameW.Length + StyleNameW.Length + (sizeof(WCHAR) << 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Cp += FamilyNameW.Length + sizeof(WCHAR);
|
|
||||||
}
|
|
||||||
Otm->otmpFullName = (LPSTR)(Cp - (char*) Otm);
|
|
||||||
wcscpy((WCHAR*) Cp, FamilyNameW.Buffer);
|
|
||||||
wcscat((WCHAR*) Cp, L" ");
|
|
||||||
wcscat((WCHAR*) Cp, StyleNameW.Buffer);
|
|
||||||
|
|
||||||
RtlFreeUnicodeString(&StyleNameW);
|
/* unique name (full name) */
|
||||||
|
Otm->otmpFullName = (LPSTR)(Cp - (char*) Otm);
|
||||||
|
wcscpy((WCHAR*) Cp, FullNameW.Buffer);
|
||||||
|
Cp += FullNameW.Length + sizeof(WCHAR);
|
||||||
|
|
||||||
|
ASSERT(Cp - (char*)Otm == Needed);
|
||||||
|
|
||||||
RtlFreeUnicodeString(&FamilyNameW);
|
RtlFreeUnicodeString(&FamilyNameW);
|
||||||
|
RtlFreeUnicodeString(&FaceNameW);
|
||||||
|
RtlFreeUnicodeString(&StyleNameW);
|
||||||
|
RtlFreeUnicodeString(&FullNameW);
|
||||||
|
|
||||||
return Needed;
|
return Needed;
|
||||||
}
|
}
|
||||||
|
@ -2099,13 +2091,19 @@ IntGetFontLocalizedName(PUNICODE_STRING pNameW, FT_Face Face,
|
||||||
{
|
{
|
||||||
if (LangID != gusEnglishUS)
|
if (LangID != gusEnglishUS)
|
||||||
{
|
{
|
||||||
|
/* Retry with English US */
|
||||||
Status = IntGetFontLocalizedName(pNameW, Face, NameID, gusEnglishUS);
|
Status = IntGetFontLocalizedName(pNameW, Face, NameID, gusEnglishUS);
|
||||||
}
|
}
|
||||||
}
|
else if (NameID == TT_NAME_ID_FONT_SUBFAMILY)
|
||||||
if (Status == STATUS_NOT_FOUND)
|
{
|
||||||
{
|
RtlInitAnsiString(&AnsiName, Face->style_name);
|
||||||
RtlInitAnsiString(&AnsiName, Face->family_name);
|
Status = RtlAnsiStringToUnicodeString(pNameW, &AnsiName, TRUE);
|
||||||
Status = RtlAnsiStringToUnicodeString(pNameW, &AnsiName, TRUE);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RtlInitAnsiString(&AnsiName, Face->family_name);
|
||||||
|
Status = RtlAnsiStringToUnicodeString(pNameW, &AnsiName, TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue