Issue 15 in freetype-py: Wrong size with FT_LOAD_MONOCHROME flag

28 views
Skip to first unread message

freet...@googlecode.com

unread,
Sep 22, 2011, 6:28:18 PM9/22/11
to Nicolas...@inria.fr
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 15 by yarosla...@gmail.com: Wrong size with FT_LOAD_MONOCHROME
flag
http://code.google.com/p/freetype-py/issues/detail?id=15

When loading with monochrome, glyph bitmap has much smaller size than
reported width*height. In the example below, you get following output:

Dimensions: 7, 39, total size: 273
Dimensions: 7, 38, total size: 76


import sys, pickle, numpy, Image
from freetype import *

face = Face('1550.ttf')
face.set_char_size(48*64)

def load_glyph(flags):
face.load_glyph(3, flags)
bitmap = face.glyph.bitmap
w,h = bitmap.width, bitmap.rows
print "Dimensions: %d, %d, total size: %d"%(w, h,len(bitmap.buffer))

load_glyph(FT_LOAD_RENDER)
load_glyph(FT_LOAD_RENDER|FT_LOAD_MONOCHROME)


Attachments:
1550.ttf 201 KB

freet...@googlecode.com

unread,
Sep 23, 2011, 2:37:18 AM9/23/11
to Nicolas...@inria.fr
Updates:
Status: Invalid

Comment #1 on issue 15 by Nicolas.Rougier: Wrong size with
FT_LOAD_MONOCHROME flag
http://code.google.com/p/freetype-py/issues/detail?id=15

I think it is ok since monochrome glyphs are encoded using 1 bit per pixel
(not byte). So 76 should correspond more or less to the right size (there
is also some padding involved).

Have a look at:
http://code.google.com/p/freetype-py/source/browse/trunk/examples/glyph-monochrome.py

Nicolas

Reply all
Reply to author
Forward
0 new messages