mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-25 08:51:07 +01:00
Add graphite2 integration from Martin Hosken
To be modified, a lot.
This commit is contained in:
1 parent
0e6d36d8a3
commit
1f49cf32c9
9 files changed
+542
-18
No files matched your search
@@ -29,17 +29,15 @@ cdef extern from "hb-common.h" :
|
||||
ctypedef unsigned long hb_tag_t
|
||||
hb_tag_t hb_tag_from_string (char *s)
|
||||
ctypedef void (*hb_destroy_func_t) (void *user_data)
|
||||
ctypedef void *hb_language_t
|
||||
hb_language_t hb_language_from_string(char *str)
|
||||
char * hb_language_to_string(hb_language_t language)
|
||||
|
||||
cdef extern from "hb-unicode.h" :
|
||||
# there must be a better way of syncing this list with the true source
|
||||
ctypedef enum hb_script_t :
|
||||
HB_SCRIPT_COMMON = 0
|
||||
|
||||
cdef extern from "hb-language.h" :
|
||||
ctypedef void *hb_language_t
|
||||
hb_language_t hb_language_from_string(char *str)
|
||||
char * hb_language_to_string(hb_language_t language)
|
||||
|
||||
cdef extern from "hb-ot-tag.h" :
|
||||
hb_script_t hb_ot_tag_to_script (hb_tag_t tag)
|
||||
|
||||
@@ -80,8 +78,8 @@ cdef extern from "hb-buffer.h" :
|
||||
void hb_buffer_add_glyph(hb_buffer_t *buffer, hb_codepoint_t codepoint, hb_mask_t mask, unsigned int cluster)
|
||||
void hb_buffer_add_utf8(hb_buffer_t *buffer, char *text, unsigned int text_length, unsigned int item_offset, unsigned int item_length)
|
||||
unsigned int hb_buffer_get_length(hb_buffer_t *buffer)
|
||||
hb_glyph_info_t *hb_buffer_get_glyph_infos(hb_buffer_t *buffer)
|
||||
hb_glyph_position_t *hb_buffer_get_glyph_positions(hb_buffer_t *buffer)
|
||||
hb_glyph_info_t *hb_buffer_get_glyph_infos(hb_buffer_t *buffer, unsigned int *len)
|
||||
hb_glyph_position_t *hb_buffer_get_glyph_positions(hb_buffer_t *buffer, unsigned int *len)
|
||||
|
||||
cdef extern from "hb-blob.h" :
|
||||
cdef struct hb_blob_t :
|
||||
@@ -111,7 +109,7 @@ cdef extern from "hb-shape.h" :
|
||||
unsigned int start
|
||||
unsigned int end
|
||||
|
||||
void hb_shape (hb_font_t *font, hb_face_t *face, hb_buffer_t *buffer, hb_feature_t *features, unsigned int num_features)
|
||||
void hb_shape (hb_font_t *font, hb_buffer_t *buffer, hb_feature_t *features, unsigned int num_features)
|
||||
|
||||
cdef extern from "hb-ft.h" :
|
||||
hb_face_t *hb_ft_face_create (FT_Face ft_face, hb_destroy_func_t destroy)
|
||||
@@ -156,8 +154,8 @@ cdef class buffer :
|
||||
res = []
|
||||
|
||||
num = hb_buffer_get_length(self.buffer)
|
||||
infos = hb_buffer_get_glyph_infos(self.buffer)
|
||||
positions = hb_buffer_get_glyph_positions(self.buffer)
|
||||
infos = hb_buffer_get_glyph_infos(self.buffer, &num)
|
||||
positions = hb_buffer_get_glyph_positions(self.buffer, &num)
|
||||
for 0 <= i < num :
|
||||
temp = glyphinfo(infos[i].codepoint, infos[i].cluster, (positions[i].x_advance / scale, positions[i].y_advance / scale), (positions[i].x_offset / scale, positions[i].y_offset / scale), positions[i].var.u32)
|
||||
res.append(temp)
|
||||
@@ -210,6 +208,6 @@ cdef class ft :
|
||||
aFeat.start = 0
|
||||
aFeat.end = -1
|
||||
aFeat += 1
|
||||
hb_shape(self.hbfont, self.hbface, aBuffer.buffer, feats, len(features))
|
||||
hb_shape(self.hbfont, aBuffer.buffer, feats, len(features))
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
LD_LIBRARY_PATH=../../src/.libs PYTHONPATH=build/lib.`python -c 'import distutils.util, sys; print distutils.util.get_platform()+"-"+str(sys.version_info[0])+"."+str(sys.version_info[1])'` "$@"
|
||||
@@ -100,9 +100,9 @@ if not opts.nogui :
|
||||
glyphs = []
|
||||
org = [0, 0]
|
||||
for g in res :
|
||||
glyphs.append((g.gid, org[0] + g.offset[0], org[1] + g.offset[1]))
|
||||
glyphs.append((g.gid, org[0] + g.offset[0], org[1] - g.offset[1]))
|
||||
org[0] += g.advance[0]
|
||||
org[1] += g.advance[1]
|
||||
org[1] -= g.advance[1]
|
||||
|
||||
gobject.type_register(GlyphsWindow)
|
||||
win = gtk.Window()
|
||||
|
||||
+16
-2
@@ -1,10 +1,23 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from distutils.core import setup
|
||||
from optparse import OptionParser
|
||||
from glob import glob
|
||||
from Pyrex.Distutils.extension import Extension
|
||||
from Pyrex.Distutils import build_ext
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option('-b','--build', help='Build directory in which libraries are found. Relative to project root')
|
||||
parser.disable_interspersed_args()
|
||||
|
||||
(opts, args) = parser.parse_args()
|
||||
|
||||
rfile = file("runpy", "w")
|
||||
rfile.write("""#!/bin/sh
|
||||
LD_LIBRARY_PATH=../../%s/src/.libs PYTHONPATH=build/lib.`python -c 'import distutils.util, sys; print distutils.util.get_platform()+"-"+str(sys.version_info[0])+"."+str(sys.version_info[1])'` "$@"
|
||||
""" % opts.build)
|
||||
rfile.close()
|
||||
|
||||
setup(name='harfbuzz',
|
||||
version='0.0.1',
|
||||
description='Harfbuzz compatibility layer',
|
||||
@@ -13,13 +26,14 @@ setup(name='harfbuzz',
|
||||
maintainer_email='martin_hosken@sil.org',
|
||||
packages=['harfbuzz'],
|
||||
ext_modules = [
|
||||
Extension("harfbuzz", ["lib/harfbuzz.pyx"], libraries=["harfbuzz"], library_dirs=["../../src/.libs"], include_dirs=["/usr/include/freetype2", "../../src"]),
|
||||
Extension("harfbuzz", ["lib/harfbuzz.pyx"], libraries=["harfbuzz"], library_dirs=["../../%s/src/.libs" % opts.build], include_dirs=["/usr/include/freetype2", "../../src", "../../%s/src" % opts.build]),
|
||||
Extension("fontconfig", ["lib/fontconfig.pyx"], libraries=["fontconfig"])
|
||||
],
|
||||
cmdclass = {'build_ext' : build_ext},
|
||||
scripts = glob('scripts/*'),
|
||||
license = 'LGPL',
|
||||
platforms = ['Linux', 'Win32', 'Mac OS X'],
|
||||
package_dir = {'harfbuzz' : 'lib'}
|
||||
package_dir = {'harfbuzz' : 'lib'},
|
||||
script_args = args
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user