diff options
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp | 25 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.c | 22 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.h | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_mac.c | 15 |
5 files changed, 33 insertions, 35 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp index 6eae6dbe5d6..d75b933cd36 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp @@ -798,37 +798,36 @@ getGlyphAdvances(XeTeXLayoutEngine engine, float advances[]) } void -getGlyphPositions(XeTeXLayoutEngine engine, float positions[]) +getGlyphPositions(XeTeXLayoutEngine engine, FloatPoint positions[]) { int glyphCount = hb_buffer_get_length(engine->hbBuffer); hb_glyph_position_t *hbPositions = hb_buffer_get_glyph_positions(engine->hbBuffer, NULL); - int i = 0; float x = 0, y = 0; if (engine->font->getLayoutDirVertical()) { - for (i = 0; i < glyphCount; i++) { - positions[2*i] = - engine->font->unitsToPoints(x + hbPositions[i].y_offset); /* negative is forwards */ - positions[2*i+1] = engine->font->unitsToPoints(y - hbPositions[i].x_offset); + for (int i = 0; i < glyphCount; i++) { + positions[i].x = -engine->font->unitsToPoints(x + hbPositions[i].y_offset); /* negative is forwards */ + positions[i].y = engine->font->unitsToPoints(y - hbPositions[i].x_offset); x += hbPositions[i].y_advance; y += hbPositions[i].x_advance; } - positions[2*i] = - engine->font->unitsToPoints(x); - positions[2*i+1] = engine->font->unitsToPoints(y); + positions[glyphCount].x = -engine->font->unitsToPoints(x); + positions[glyphCount].y = engine->font->unitsToPoints(y); } else { - for (i = 0; i < glyphCount; i++) { - positions[2*i] = engine->font->unitsToPoints(x + hbPositions[i].x_offset); - positions[2*i+1] = - engine->font->unitsToPoints(y + hbPositions[i].y_offset); /* negative is upwards */ + for (int i = 0; i < glyphCount; i++) { + positions[i].x = engine->font->unitsToPoints(x + hbPositions[i].x_offset); + positions[i].y = -engine->font->unitsToPoints(y + hbPositions[i].y_offset); /* negative is upwards */ x += hbPositions[i].x_advance; y += hbPositions[i].y_advance; } - positions[2*i] = engine->font->unitsToPoints(x); - positions[2*i+1] = - engine->font->unitsToPoints(y); + positions[glyphCount].x = engine->font->unitsToPoints(x); + positions[glyphCount].y = -engine->font->unitsToPoints(y); } if (engine->extend != 1.0 || engine->slant != 0.0) for (int i = 0; i <= glyphCount; ++i) - positions[2*i] = positions[2*i] * engine->extend - positions[2*i+1] * engine->slant; + positions[i].x = positions[i].x * engine->extend - positions[i].y * engine->slant; } float diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h index c7211645833..009dc824966 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h +++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h @@ -114,7 +114,7 @@ int layoutChars(XeTeXLayoutEngine engine, uint16_t* chars, int32_t offset, int32 void getGlyphs(XeTeXLayoutEngine engine, uint32_t* glyphs); void getGlyphAdvances(XeTeXLayoutEngine engine, float *advances); -void getGlyphPositions(XeTeXLayoutEngine engine, float* positions); +void getGlyphPositions(XeTeXLayoutEngine engine, FloatPoint* positions); float getPointSize(XeTeXLayoutEngine engine); diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c index 721ab678724..74e19024125 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c @@ -1644,7 +1644,7 @@ makefontdef(integer f) t = CTFontGetMatrix(font); extend = t.a; - slant = t.b; + slant = t.c; emboldenNumber = CFDictionaryGetValue(attributes, kXeTeXEmboldenAttributeName); if (emboldenNumber) @@ -2012,7 +2012,7 @@ measure_native_node(void* pNode, int use_glyph_metrics) UBiDiDirection dir; void* glyph_info = 0; - static float* positions = 0; + static FloatPoint* positions = 0; static float* advances = 0; static uint32_t* glyphs = 0; @@ -2052,7 +2052,7 @@ measure_native_node(void* pNode, int use_glyph_metrics) (dir == UBIDI_RTL)); glyphs = (uint32_t*) xcalloc(nGlyphs, sizeof(uint32_t)); - positions = (float*) xcalloc(nGlyphs * 2 + 2, sizeof(float)); + positions = (FloatPoint*) xcalloc(nGlyphs + 1, sizeof(FloatPoint)); advances = (float*) xcalloc(nGlyphs, sizeof(float)); getGlyphs(engine, glyphs); @@ -2061,13 +2061,13 @@ measure_native_node(void* pNode, int use_glyph_metrics) for (i = 0; i < nGlyphs; ++i) { glyphIDs[totalGlyphCount] = glyphs[i]; - locations[totalGlyphCount].x = D2Fix(positions[2*i] + x); - locations[totalGlyphCount].y = D2Fix(positions[2*i+1] + y); + locations[totalGlyphCount].x = D2Fix(positions[i].x + x); + locations[totalGlyphCount].y = D2Fix(positions[i].y + y); glyphAdvances[totalGlyphCount] = D2Fix(advances[i]); ++totalGlyphCount; } - x += positions[2*i]; - y += positions[2*i+1]; + x += positions[nGlyphs].x; + y += positions[nGlyphs].y; free(glyphs); free(positions); @@ -2084,7 +2084,7 @@ measure_native_node(void* pNode, int use_glyph_metrics) totalGlyphCount = layoutChars(engine, txtPtr, 0, txtLen, txtLen, (dir == UBIDI_RTL)); glyphs = (uint32_t*) xcalloc(totalGlyphCount, sizeof(uint32_t)); - positions = (float*) xcalloc(totalGlyphCount * 2 + 2, sizeof(float)); + positions = (FloatPoint*) xcalloc(totalGlyphCount + 1, sizeof(FloatPoint)); advances = (float*) xcalloc(totalGlyphCount, sizeof(float)); getGlyphs(engine, glyphs); @@ -2100,10 +2100,10 @@ measure_native_node(void* pNode, int use_glyph_metrics) for (i = 0; i < totalGlyphCount; ++i) { glyphIDs[i] = glyphs[i]; glyphAdvances[i] = D2Fix(advances[i]); - locations[i].x = D2Fix(positions[2*i]); - locations[i].y = D2Fix(positions[2*i+1]); + locations[i].x = D2Fix(positions[i].x); + locations[i].y = D2Fix(positions[i].y); } - width = D2Fix(positions[2*i]); + width = D2Fix(positions[totalGlyphCount].x); } node_width(node) = width; diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h index b0c42fe3060..3e93d651288 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h @@ -63,6 +63,10 @@ typedef struct { typedef uint32_t OTTag; typedef uint16_t GlyphID; +typedef struct { + float x; + float y; +} FloatPoint; /* these are also in xetex.web and must correspond! */ diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c index f3e78cb588b..d11a722c310 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c @@ -167,15 +167,11 @@ DoAATLayout(void* p, int justify) // Swap X and Y when doing vertical layout if (vertical == kCFBooleanTrue) { - locations[totalGlyphCount].x = FixedPStoTeXPoints(-positions[j].y); - // XXX trasformation matrix changes y positions! - //locations[totalGlyphCount].y = FixedPStoTeXPoints(-positions[j].x); - locations[totalGlyphCount].y = 0; + locations[totalGlyphCount].x = -FixedPStoTeXPoints(positions[j].y); + locations[totalGlyphCount].y = FixedPStoTeXPoints(positions[j].x); } else { - locations[totalGlyphCount].x = FixedPStoTeXPoints(positions[j].x); - // XXX trasformation matrix changes y positions! - //locations[totalGlyphCount].y = FixedPStoTeXPoints(positions[j].y); - locations[totalGlyphCount].y = 0; + locations[totalGlyphCount].x = FixedPStoTeXPoints(positions[j].x); + locations[totalGlyphCount].y = -FixedPStoTeXPoints(positions[j].y); } glyphAdvances[totalGlyphCount] = advances[j].width; totalGlyphCount++; @@ -769,9 +765,8 @@ loadAATfont(CTFontDescriptorRef descriptor, integer scaled_size, const char* cp1 } matrix = CGAffineTransformIdentity; - // XXX this breaks y glyph positioning if (extend != 1.0 || slant != 0.0) - matrix = CGAffineTransformMake(extend, slant, 0, 1.0, 0, 0); + matrix = CGAffineTransformMake(extend, 0, slant, 1.0, 0, 0); if (embolden != 0.0) { CFNumberRef emboldenNumber; |