diff options
author | Khaled Hosny <khaled@aliftype.com> | 2022-09-16 14:46:27 +0200 |
---|---|---|
committer | خالد حسني <khaled@aliftype.com> | 2022-09-19 13:38:17 +0200 |
commit | 8453d7ea1ff5b2b93196ed4b4bf430d6c574a7cb (patch) | |
tree | 205718ecb4b1224fe334aff41c96d8696593b8f6 /vcl/source/font/LogicalFontInstance.cxx | |
parent | ba164651bbdbde1b8a4ae3495b845ebc13b01bad (diff) |
vcl: Add PhysicalFontFace::UnitsPerEm()
Change-Id: I9239085aabe450499193e74ac91d6a16437545c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140124
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
Diffstat (limited to 'vcl/source/font/LogicalFontInstance.cxx')
-rw-r--r-- | vcl/source/font/LogicalFontInstance.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/vcl/source/font/LogicalFontInstance.cxx b/vcl/source/font/LogicalFontInstance.cxx index ce6ea99ee8f3..b882ce93dfe4 100644 --- a/vcl/source/font/LogicalFontInstance.cxx +++ b/vcl/source/font/LogicalFontInstance.cxx @@ -54,10 +54,11 @@ LogicalFontInstance::~LogicalFontInstance() hb_font_t* LogicalFontInstance::InitHbFont() { - hb_face_t* pHbFace = GetFontFace()->GetHbFace(); + auto pFace = GetFontFace(); + hb_face_t* pHbFace = pFace->GetHbFace(); assert(pHbFace); hb_font_t* pHbFont = hb_font_create(pHbFace); - unsigned int nUPEM = hb_face_get_upem(pHbFace); + auto nUPEM = pFace->UnitsPerEm(); hb_font_set_scale(pHbFont, nUPEM, nUPEM); hb_ot_font_set_funcs(pHbFont); ImplInitHbFont(pHbFont); @@ -74,9 +75,7 @@ int LogicalFontInstance::GetKashidaWidth() const void LogicalFontInstance::GetScale(double* nXScale, double* nYScale) const { - hb_face_t* pHbFace = hb_font_get_face(const_cast<LogicalFontInstance*>(this)->GetHbFont()); - unsigned int nUPEM = hb_face_get_upem(pHbFace); - + double nUPEM = GetFontFace()->UnitsPerEm(); double nHeight(m_aFontSelData.mnHeight); // On Windows, mnWidth is relative to average char width not font height, @@ -162,8 +161,7 @@ double LogicalFontInstance::GetGlyphWidth(sal_GlyphId nGlyph, bool bVertical, bo if (bPDF) { - unsigned int nUPEM = hb_face_get_upem(hb_font_get_face(pHbFont)); - return (nWidth * 1000) / nUPEM; + return (nWidth * 1000) / GetFontFace()->UnitsPerEm(); } else { |