summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2022-09-11 16:28:38 +0200
committerخالد حسني <khaled@aliftype.com>2022-09-13 15:28:34 +0200
commit196a8331ccb80fa7d79b74e827bf5433321b9815 (patch)
treefdd9e1fe1f95a9114827f85ff4c42e01e19699e4 /vcl
parent1bf6acf0fe438194d76e7fb2f605ed26c7914f55 (diff)
vcl: Simplify calling FillFontSubsetInfo()
Change-Id: I725ad2f3dcdbe032c0a36d9649a2ed85a499a20a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139800 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/sft.hxx3
-rw-r--r--vcl/source/font/PhysicalFontFace.cxx5
-rw-r--r--vcl/source/fontsubset/sft.cxx24
3 files changed, 15 insertions, 17 deletions
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index ccadaeb8d0b5..9c73c8ace308 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -631,8 +631,7 @@ class TrueTypeFace;
const sal_uInt8* pEncoding,
int nGlyphCount, FontSubsetInfo& rInfo);
- VCL_DLLPUBLIC void FillFontSubsetInfo(const TTGlobalFontInfo& rTTInfo,
- const OUString& pPSName,
+ VCL_DLLPUBLIC void FillFontSubsetInfo(AbstractTrueTypeFont *ttf,
FontSubsetInfo& rInfo);
/**
* Generates a new PostScript Type42 font and dumps it to <b>outf</b> file.
diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx
index 245eab3ed88e..b8b0bf0316cd 100644
--- a/vcl/source/font/PhysicalFontFace.cxx
+++ b/vcl/source/font/PhysicalFontFace.cxx
@@ -307,10 +307,7 @@ bool PhysicalFontFace::CreateFontSubset(const OUString& rToFile, const sal_Glyph
return false;
// Get details about the subset font.
- TTGlobalFontInfo aTTInfo;
- GetTTGlobalFontInfo(&aSftFont, &aTTInfo);
- OUString aPSName(aTTInfo.psname, std::strlen(aTTInfo.psname), RTL_TEXTENCODING_UTF8);
- FillFontSubsetInfo(aTTInfo, aPSName, rInfo);
+ FillFontSubsetInfo(&aSftFont, rInfo);
// write subset into destination file
return CreateTTFfontSubset(aSftFont, aToFile, pGlyphIds, pEncoding, nGlyphCount);
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 1e270805fb90..955e70b347c6 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -2348,27 +2348,29 @@ void GetTTGlobalFontInfo(AbstractTrueTypeFont *ttf, TTGlobalFontInfo *info)
}
}
-void FillFontSubsetInfo(const vcl::TTGlobalFontInfo& rTTInfo, const OUString& pPSName,
- FontSubsetInfo& rInfo)
+void FillFontSubsetInfo(AbstractTrueTypeFont *ttf, FontSubsetInfo& rInfo)
{
- rInfo.m_aPSName = pPSName;
+ TTGlobalFontInfo aTTInfo;
+ GetTTGlobalFontInfo(ttf, &aTTInfo);
+
+ rInfo.m_aPSName = OUString::fromUtf8(aTTInfo.psname);
rInfo.m_nFontType = FontType::SFNT_TTF;
rInfo.m_aFontBBox
- = tools::Rectangle(Point(rTTInfo.xMin, rTTInfo.yMin), Point(rTTInfo.xMax, rTTInfo.yMax));
- rInfo.m_nCapHeight = rTTInfo.yMax; // Well ...
- rInfo.m_nAscent = rTTInfo.winAscent;
- rInfo.m_nDescent = rTTInfo.winDescent;
+ = tools::Rectangle(Point(aTTInfo.xMin, aTTInfo.yMin), Point(aTTInfo.xMax, aTTInfo.yMax));
+ rInfo.m_nCapHeight = aTTInfo.yMax; // Well ...
+ rInfo.m_nAscent = aTTInfo.winAscent;
+ rInfo.m_nDescent = aTTInfo.winDescent;
// mac fonts usually do not have an OS2-table
// => get valid ascent/descent values from other tables
if (!rInfo.m_nAscent)
- rInfo.m_nAscent = +rTTInfo.typoAscender;
+ rInfo.m_nAscent = +aTTInfo.typoAscender;
if (!rInfo.m_nAscent)
- rInfo.m_nAscent = +rTTInfo.ascender;
+ rInfo.m_nAscent = +aTTInfo.ascender;
if (!rInfo.m_nDescent)
- rInfo.m_nDescent = +rTTInfo.typoDescender;
+ rInfo.m_nDescent = +aTTInfo.typoDescender;
if (!rInfo.m_nDescent)
- rInfo.m_nDescent = -rTTInfo.descender;
+ rInfo.m_nDescent = -aTTInfo.descender;
}
GlyphData *GetTTRawGlyphData(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID)