Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/hello-vf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
height = max(height,
bitmap.rows + max(0,-(slot.bitmap_top-bitmap.rows)))
baseline = max(baseline, max(0,-(slot.bitmap_top-bitmap.rows)))
kerning = face.get_kerning(previous, c)
kerning = face.get_kerning(face.get_char_index(previous), face.get_char_index(c))
width += (slot.advance.x >> 6) + (kerning.x >> 6)
previous = c

Expand All @@ -48,7 +48,7 @@
left = slot.bitmap_left
w,h = bitmap.width, bitmap.rows
y = (height - baseline - top) - (i * 48)
kerning = face.get_kerning(previous, c)
kerning = face.get_kerning(face.get_char_index(previous), face.get_char_index(c))
x += (kerning.x >> 6)
Z[y:y+h,x+left:x+left+w] += numpy.array(bitmap.buffer, dtype='ubyte').reshape(h,w)
x += (slot.advance.x >> 6)
Expand Down
4 changes: 2 additions & 2 deletions examples/hello-world-cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
height = max(height,
bitmap.rows + max(0,-(slot.bitmap_top-bitmap.rows)))
baseline = max(baseline, max(0,-(slot.bitmap_top-bitmap.rows)))
kerning = face.get_kerning(previous, c)
kerning = face.get_kerning(face.get_char_index(previous), face.get_char_index(c))
width += (slot.advance.x >> 6) + (kerning.x >> 6)
previous = c

Expand All @@ -47,7 +47,7 @@
left = slot.bitmap_left
w,h = bitmap.width, bitmap.rows
y = height-baseline-top
kerning = face.get_kerning(previous, c)
kerning = face.get_kerning(face.get_char_index(previous), face.get_char_index(c))
x += (kerning.x >> 6)
# cairo does not like zero-width bitmap from the space character!
if (bitmap.width > 0):
Expand Down
4 changes: 2 additions & 2 deletions examples/hello-world.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
bitmap = slot.bitmap
top = max(top, slot.bitmap_top)
bot = min(bot, slot.bitmap_top - bitmap.rows)
kerning = face.get_kerning(previous, c)
kerning = face.get_kerning(face.get_char_index(previous), face.get_char_index(c))
width += (slot.advance.x >> 6) + (kerning.x >> 6)
previous = c

Expand All @@ -43,7 +43,7 @@
bitmap = slot.bitmap
w,h = bitmap.width, bitmap.rows
y = top - slot.bitmap_top
kerning = face.get_kerning(previous, c)
kerning = face.get_kerning(face.get_char_index(previous), face.get_char_index(c))
x += (kerning.x >> 6)
Z[y:y+h,x+left:x+left+w] += numpy.array(bitmap.buffer, dtype='ubyte').reshape(h,w)
x += (slot.advance.x >> 6)
Expand Down
4 changes: 2 additions & 2 deletions examples/texture_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,10 @@ def load(self, charcodes = ''):
for g in self.glyphs.values():
# 64 * 64 because of 26.6 encoding AND the transform matrix used
# in texture_font_load_face (hres = 64)
kerning = face.get_kerning(g.charcode, charcode, mode=FT_KERNING_UNFITTED)
kerning = face.get_kerning(face.get_char_index(g.charcode), face.get_char_index(charcode), mode=FT_KERNING_UNFITTED)
if kerning.x != 0:
glyph.kerning[g.charcode] = kerning.x/(64.0*64.0)
kerning = face.get_kerning(charcode, g.charcode, mode=FT_KERNING_UNFITTED)
kerning = face.get_kerning(face.get_char_index(charcode), face.get_char_index(g.charcode), mode=FT_KERNING_UNFITTED)
if kerning.x != 0:
g.kerning[charcode] = kerning.x/(64.0*64.0)

Expand Down
4 changes: 2 additions & 2 deletions examples/wordle-cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def make_label(text, filename, size=12, angle=0):
ymin, ymax = 0, 0
for c in text:
face.load_char(c, flags)
kerning = face.get_kerning(previous, c)
kerning = face.get_kerning(face.get_char_index(previous), face.get_char_index(c))
previous = c
bitmap = face.glyph.bitmap
pitch = face.glyph.bitmap.pitch
Expand All @@ -91,7 +91,7 @@ def make_label(text, filename, size=12, angle=0):
ctx = Context(L)
for c in text:
face.load_char(c, flags)
kerning = face.get_kerning(previous, c)
kerning = face.get_kerning(face.get_char_index(previous), face.get_char_index(c))
previous = c
bitmap = face.glyph.bitmap
pitch = face.glyph.bitmap.pitch
Expand Down
4 changes: 2 additions & 2 deletions examples/wordle.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def make_label(text, filename, size=12, angle=0):
ymin, ymax = 0, 0
for c in text:
face.load_char(c, flags)
kerning = face.get_kerning(previous, c)
kerning = face.get_kerning(face.get_char_index(previous), face.get_char_index(c))
previous = c
bitmap = face.glyph.bitmap
pitch = face.glyph.bitmap.pitch
Expand All @@ -63,7 +63,7 @@ def make_label(text, filename, size=12, angle=0):
pen.x, pen.y = 0, 0
for c in text:
face.load_char(c, flags)
kerning = face.get_kerning(previous, c)
kerning = face.get_kerning(face.get_char_index(previous), face.get_char_index(c))
previous = c
bitmap = face.glyph.bitmap
pitch = face.glyph.bitmap.pitch
Expand Down
4 changes: 1 addition & 3 deletions freetype/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1591,11 +1591,9 @@ def get_kerning( self, left, right, mode = FT_KERNING_DEFAULT ):
of the scope of this API function -- they can be implemented through
format-specific interfaces.
'''
left_glyph = self.get_char_index( left )
right_glyph = self.get_char_index( right )
kerning = FT_Vector(0,0)
error = FT_Get_Kerning( self._FT_Face,
left_glyph, right_glyph, mode, byref(kerning) )
left, right, mode, byref(kerning) )
if error: raise FT_Exception( error )
return kerning

Expand Down
Loading