summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2022-08-12 02:51:50 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-08-14 21:12:21 +0200
commit3d0e482df81a28e6d0eb86cda71ac49d3363ae50 (patch)
treec2fe8c9a129a2db7d9c03bc72539162280b7eb36
parentStreamline Kashida validation logic (diff)
downloadcore-3d0e482df81a28e6d0eb86cda71ac49d3363ae50.tar.gz
core-3d0e482df81a28e6d0eb86cda71ac49d3363ae50.zip
tdf#106653: Try harder not to return 0 for Kashida width
The font in the bug document has a very small Kashida advance width and this gets rounded to zero at smaller zoom level. Try to round up the value to avoid returning zero too eagerly. Change-Id: I78c309d66a9e94812827c7c6724c67c4d09bcff9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138169 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/font/fontinstance.cxx2
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx2
2 files changed, 2 insertions, 2 deletions
diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 0907d657ad02..44c2c8cc757d 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -73,7 +73,7 @@ int LogicalFontInstance::GetKashidaWidth() const
{
double nXScale = 0;
GetScale(&nXScale, nullptr);
- nWidth = hb_font_get_glyph_h_advance(pHbFont, nIndex) * nXScale;
+ nWidth = std::ceil(hb_font_get_glyph_h_advance(pHbFont, nIndex) * nXScale);
}
return nWidth;
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index b3d63dac30a0..0bea121896b4 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -761,7 +761,7 @@ void GenericSalLayout::ApplyDXArray(const DC* pDXArray, const sal_Bool* pKashida
if (nKashidaWidth <= 0)
{
- SAL_WARN("vcl.gdi", "Asked to insert Kashidas in a font with zero-width Kashida");
+ SAL_WARN("vcl.gdi", "Asked to insert Kashidas in a font with bogus Kashida width");
return;
}