vcl: Add TrueTypeFont::getTypeFlags()

Change-Id: I16bf9fc3cbe5794023fdd54a5c8ec312f4d55697
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203707
Reviewed-by: Khaled Hosny <khaled@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Khaled Hosny
2026-04-16 21:33:54 +02:00
committed by Khaled Hosny
parent fe65c51b40
commit b63e9bc4dc
3 changed files with 10 additions and 7 deletions
+1 -1
View File
@@ -59,7 +59,6 @@ namespace vcl
typedef struct TTGlobalFontInfo_ {
bool microsoftSymbolEncoded = false; /**< true: MS symbol encoded */
sal_uInt32 typeFlags = 0; /**< type flags (copyright bits) */
} TTGlobalFontInfo;
@@ -319,6 +318,7 @@ public:
FontWidth getFontWidth() const;
FontItalic getFontItalic() const;
FontPitch getFontPitch() const;
sal_uInt32 getTypeFlags() const;
};
} // namespace vcl
+8 -4
View File
@@ -160,10 +160,6 @@ TTGlobalFontInfo TrueTypeFont::getGlobalFontInfo() const
if (!aCmap.empty())
info.microsoftSymbolEncoded = HasMicrosoftSymbolCmap(aCmap.data(), aCmap.size());
auto aOS2 = getTable(T_OS2);
if (aOS2.size() >= 42)
info.typeFlags = GetUInt16(aOS2.data(), OS2_fsType_offset);
return info;
}
@@ -190,6 +186,14 @@ static FontWeight ImplWeightToSal( float nWeight )
return WEIGHT_BLACK;
}
sal_uInt32 TrueTypeFont::getTypeFlags() const
{
auto aOS2 = getTable(T_OS2);
if (aOS2.size() >= 42)
return GetUInt16(aOS2.data(), OS2_fsType_offset);
return 0;
}
FontPitch TrueTypeFont::getFontPitch() const
{
auto aPost = getTable(T_post);
+1 -2
View File
@@ -227,9 +227,8 @@ OUString getFilenameForExport(std::u16string_view familyName, FontFamily family,
bool sufficientTTFRights(const TrueTypeFont& font,
EmbeddedFontsManager::FontRights rights)
{
TTGlobalFontInfo info = font.getGlobalFontInfo();
// https://www.microsoft.com/typography/otspec/os2.htm#fst
int copyright = info.typeFlags;
int copyright = font.getTypeFlags();
switch (rights)
{
case EmbeddedFontsManager::FontRights::ViewingAllowed: