From: Behdad Esfahbod Date: Thu, 23 May 2013 19:43:02 +0000 (-0400) Subject: [icu_le] Fix scaling X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9408d24f3029f5287b17779235b1c750ff5158a;p=platform%2Fupstream%2FlibHarfBuzzSharp.git [icu_le] Fix scaling Seems to work... --- diff --git a/src/hb-icu-le.cc b/src/hb-icu-le.cc index c05d330..350f5c6 100644 --- a/src/hb-icu-le.cc +++ b/src/hb-icu-le.cc @@ -63,6 +63,8 @@ _hb_icu_le_shaper_font_data_create (hb_font_t *font) { LEErrorCode status = LE_NO_ERROR; hb_icu_le_shaper_font_data_t *data = new PortableFontInstance (font->face, + 1, + 1, font->x_scale, font->y_scale, status); diff --git a/src/hb-icu-le/PortableFontInstance.cpp b/src/hb-icu-le/PortableFontInstance.cpp index c38e2b1..9d423c4 100644 --- a/src/hb-icu-le/PortableFontInstance.cpp +++ b/src/hb-icu-le/PortableFontInstance.cpp @@ -25,8 +25,16 @@ #include -PortableFontInstance::PortableFontInstance(hb_face_t *face, float xScale, float yScale, LEErrorCode &status) - : fFace(face), fXScale(xScale), fYScale(yScale), fUnitsPerEM(0), fAscent(0), fDescent(0), fLeading(0), +PortableFontInstance::PortableFontInstance(hb_face_t *face, + float xScale, + float yScale, + unsigned int xPixelsPerEM, + unsigned int yPixelsPerEM, + LEErrorCode &status) + : fFace(face), + fXScale(xScale), fYScale(yScale), + fXPixelsPerEM(xPixelsPerEM), fYPixelsPerEM(yPixelsPerEM), + fUnitsPerEM(0), fAscent(0), fDescent(0), fLeading(0), fNAMETable(NULL), fNameCount(0), fNameStringOffset(0), fCMAPMapper(NULL), fHMTXTable(NULL), fNumGlyphs(0), fNumLongHorMetrics(0) { if (LE_FAILURE(status)) { @@ -194,8 +202,7 @@ void PortableFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) co index = fNumLongHorMetrics - 1; } - advance.fX = xUnitsToPoints(SWAPW(fHMTXTable->hMetrics[index].advanceWidth)); - advance.fY = 0; + transformFunits (SWAPW(fHMTXTable->hMetrics[index].advanceWidth), 0, advance); } le_bool PortableFontInstance::getGlyphPoint(LEGlyphID /*glyph*/, le_int32 /*pointNumber*/, LEPoint &/*point*/) const @@ -249,20 +256,20 @@ LEGlyphID PortableFontInstance::mapCharToGlyph(LEUnicode32 ch) const float PortableFontInstance::getXPixelsPerEm() const { - return fXScale; + return fXPixelsPerEM; } float PortableFontInstance::getYPixelsPerEm() const { - return fYScale; + return fYPixelsPerEM; } float PortableFontInstance::getScaleFactorX() const { - return 1.0; + return fXScale; } float PortableFontInstance::getScaleFactorY() const { - return 1.0; + return fYScale; } diff --git a/src/hb-icu-le/PortableFontInstance.h b/src/hb-icu-le/PortableFontInstance.h index 0794560..5b92d83 100644 --- a/src/hb-icu-le/PortableFontInstance.h +++ b/src/hb-icu-le/PortableFontInstance.h @@ -36,6 +36,8 @@ private: float fXScale; float fYScale; + unsigned int fXPixelsPerEM; + unsigned int fYPixelsPerEM; le_int32 fUnitsPerEM; le_int32 fAscent; le_int32 fDescent; @@ -59,7 +61,12 @@ protected: hb_blob_t *readFontTable(LETag tableTag) const; public: - PortableFontInstance(hb_face_t *face, float xScale, float yScale, LEErrorCode &status); + PortableFontInstance(hb_face_t *face, + float xScale, + float yScale, + unsigned int xPixelsPerEM, + unsigned int yPixelsPerEM, + LEErrorCode &status); virtual ~PortableFontInstance();