[PATCH] Fix glyph width calculation in HarfBuzz
Khaled Hosny (via Code Review)
gerrit at gerrit.libreoffice.org
Tue Apr 23 03:45:51 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3573
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/73/3573/1
Fix glyph width calculation in HarfBuzz
Make sure everything is using 16.16 fixed point values consistently.
Change-Id: Icdcd94775d3860d57bb446a3f237c31e35e0710a
---
M vcl/generic/glyphs/gcach_layout.cxx
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 1f9f3d0..ca40e9d 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -152,7 +152,7 @@
{
ServerFont* rFont = (ServerFont*) fontData;
const GlyphMetric& rGM = rFont->GetGlyphMetric(nGlyphIndex);
- return rGM.GetCharWidth();
+ return rGM.GetCharWidth() << 6;
}
static hb_position_t getGlyphAdvanceV(hb_font_t* /*font*/, void* /*fontData*/,
@@ -415,10 +415,10 @@
if (hb_ot_layout_get_glyph_class(maHbFace, nGlyphIndex) == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
nGlyphFlags |= GlyphItem::IS_DIACRITIC;
- aHbPositions[i].x_offset /= 64;
- aHbPositions[i].y_offset /= 64;
- aHbPositions[i].x_advance /= 64;
- aHbPositions[i].y_advance /= 64;
+ aHbPositions[i].x_offset = aHbPositions[i].x_offset >> 6;
+ aHbPositions[i].y_offset = aHbPositions[i].y_offset >> 6;
+ aHbPositions[i].x_advance = aHbPositions[i].x_advance >> 6;
+ aHbPositions[i].y_advance = aHbPositions[i].y_advance >> 6;
aNewPos = Point(aNewPos.X() + aHbPositions[i].x_offset, aNewPos.Y() - aHbPositions[i].y_offset);
@@ -429,7 +429,7 @@
// instead of nGlyphWidth above, and leave mnNewWidth alone
// (whatever it is meant for)
if (i + 1 < nRunGlyphCount)
- aGI.mnNewWidth = nGlyphWidth + (aHbPositions[i + 1].x_offset / 64);
+ aGI.mnNewWidth = nGlyphWidth + (aHbPositions[i + 1].x_offset >> 6);
rLayout.AppendGlyph(aGI);
--
To view, visit https://gerrit.libreoffice.org/3573
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icdcd94775d3860d57bb446a3f237c31e35e0710a
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Khaled Hosny <khaledhosny at eglug.org>
More information about the LibreOffice
mailing list