[Libreoffice-commits] core.git: Branch 'feature/commonsallayout' - vcl/source
Khaled Hosny
khaledhosny at eglug.org
Sat Oct 8 21:19:13 UTC 2016
vcl/source/gdi/CommonSalLayout.cxx | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit 8b32ead0b988b142cd9878f126d985d946fd4ccc
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Thu Oct 6 04:15:41 2016 +0200
Use HarfBuzz shape plan for a bit more control
This way we control exactly what shapers we use in what order, and as an
extra we can now tell which shaper HarfBuzz ends up using.
Change-Id: Idd303b2a557e16ac86ada0c2006d3e2a052ac489
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 7bcbf1d..d4f0dc2 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -314,6 +314,7 @@ void CommonSalLayout::DrawText( SalGraphics& rSalGraphics ) const
bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
{
+ hb_face_t* pHbFace = hb_font_get_face(mpHbFont);
hb_script_t aHbScript = HB_SCRIPT_INVALID;
int nGlyphCapacity = 2 * (rArgs.mnEndCharPos - rArgs.mnMinCharPos);
@@ -415,7 +416,13 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
#if HB_VERSION_ATLEAST(0, 9, 42)
hb_buffer_set_cluster_level(pHbBuffer, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
#endif
- hb_shape(mpHbFont, pHbBuffer, nullptr, 0);
+ const char *pHbShapers[5] = { "coretext_aat", "graphite2", "ot", "fallback", nullptr };
+ hb_segment_properties_t aHbProps;
+ hb_buffer_get_segment_properties(pHbBuffer, &aHbProps);
+ hb_shape_plan_t *pHbPlan = hb_shape_plan_create_cached(pHbFace, &aHbProps, nullptr, 0, pHbShapers);
+ assert(hb_shape_plan_execute(pHbPlan, mpHbFont, pHbBuffer, nullptr, 0));
+ hb_buffer_set_content_type(pHbBuffer, HB_BUFFER_CONTENT_TYPE_GLYPHS);
+ SAL_INFO("vcl.harfbuzz", hb_shape_plan_get_shaper(pHbPlan) << " shaper used for " << rArgs);
int nRunGlyphCount = hb_buffer_get_length(pHbBuffer);
hb_glyph_info_t *pHbGlyphInfos = hb_buffer_get_glyph_infos(pHbBuffer, nullptr);
@@ -448,7 +455,6 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
nGlyphFlags |= GlyphItem::IS_IN_CLUSTER;
bool bDiacritic = false;
- hb_face_t* pHbFace = hb_font_get_face(mpHbFont);
if (hb_ot_layout_has_glyph_classes(pHbFace))
{
// the font has GDEF table
More information about the Libreoffice-commits
mailing list