diff options
author | George Williams <pfaedit@users.sourceforge.net> | 2011-02-22 05:50:19 -0800 |
---|---|---|
committer | George Williams <pfaedit@users.sourceforge.net> | 2011-02-22 05:50:19 -0800 |
commit | b69c9652760b7a72d3f2dfb6f398b5a0f5ef5c98 (patch) | |
tree | be3bd38748fbcfc1e8aa098fb4185ac765063a97 | |
parent | db720ca4e79da3f40a98a2a12e2cb12e98179811 (diff) |
Yet another patch I trampled on. Restore it.
-rw-r--r-- | fontforge/libffstamp.h | 6 | ||||
-rw-r--r-- | fontforge/python.c | 71 | ||||
-rw-r--r-- | fontforge/stamp.c | 6 |
3 files changed, 77 insertions, 6 deletions
diff --git a/fontforge/libffstamp.h b/fontforge/libffstamp.h index c691f9f5..211de5de 100644 --- a/fontforge/libffstamp.h +++ b/fontforge/libffstamp.h @@ -1,3 +1,3 @@ -#define LibFF_ModTime 1298329534L /* Seconds since 1970 (standard unix time) */ -#define LibFF_ModTime_Str "23:05 GMT 21-Feb-2011" -#define LibFF_VersionDate 20110221 /* Year, month, day */ +#define LibFF_ModTime 1298382513L /* Seconds since 1970 (standard unix time) */ +#define LibFF_ModTime_Str "13:48 GMT 22-Feb-2011" +#define LibFF_VersionDate 20110222 /* Year, month, day */ diff --git a/fontforge/python.c b/fontforge/python.c index 72c203a3..37ba263b 100644 --- a/fontforge/python.c +++ b/fontforge/python.c @@ -5724,6 +5724,74 @@ static PyObject *PyFF_Glyph_get_manualhints(PyFF_Glyph *self,void *closure) { return( Py_BuildValue("i", self->sc->manualhints )); } +static PyObject *PyFF_Glyph_get_lcarets(PyFF_Glyph *self,void *closure) { + SplineChar *sc = ((PyFF_Glyph *) self)->sc; + int cnt=0, i; + PST *pst, *lcar = NULL; + PyObject *tuple; + + for ( pst = sc->possub; pst!=NULL; pst=pst->next ) { + if ( pst->type==pst_lcaret ) { + lcar = pst; + cnt = lcar->u.lcaret.cnt; + break; + } + } + tuple = PyTuple_New(cnt); + + if ( lcar != NULL ) { + for ( i=0; i<cnt; ++i ) { + PyTuple_SetItem( tuple,i,Py_BuildValue("i",lcar->u.lcaret.carets[i]) ); + } + } +return( tuple ); +} + +static int PyFF_Glyph_set_lcarets(PyFF_Glyph *self,PyObject *value,void *closure) { + SplineChar *sc = self->sc; + int i, cnt, lig_comp_max = 0, lc; + char *pt; + int16 *carets; + PST *pst, *lcar = NULL; + + cnt = PySequence_Size(value); + if ( cnt==-1 ) +return( -1 ); + + if ( cnt > 0 ) + carets = galloc( cnt*sizeof(int16) ); + for ( i=0; i<cnt; ++i ) { + carets[i] = PyInt_AsLong( PySequence_GetItem(value,i) ); + if ( PyErr_Occurred()) +return( -1 ); + } + + for ( pst = sc->possub; pst!=NULL; pst=pst->next ) { + if ( pst->type==pst_lcaret ) { + lcar = pst; + free( lcar->u.lcaret.carets ); + } else if ( pst->type==pst_ligature ) { + for ( lc=0, pt=pst->u.lig.components; *pt; ++pt ) + if ( *pt==' ' ) ++lc; + if ( lc>lig_comp_max ) + lig_comp_max = lc; + } + } + + if ( lcar == NULL && cnt > 0 ) { + lcar = chunkalloc(sizeof(PST)); + lcar->type = pst_lcaret; + lcar->next = sc->possub; + sc->possub = lcar; + } + if ( lcar != NULL ) { + lcar->u.lcaret.cnt = cnt; + lcar->u.lcaret.carets = cnt > 0 ? carets : NULL; + sc->lig_caret_cnt_fixed = ( cnt != lig_comp_max ) ? true : false; + } +return( 0 ); +} + static int PyFF_Glyph_set_manualhints(PyFF_Glyph *self,PyObject *value,void *closure) { int val; @@ -6614,6 +6682,9 @@ static PyGetSetDef PyFF_Glyph_getset[] = { {"manualHints", (getter)PyFF_Glyph_get_manualhints, (setter)PyFF_Glyph_set_manualhints, "The hints have been set manually, and the glyph should not be autohinted by default" }, + {"lcarets", + (getter)PyFF_Glyph_get_lcarets, (setter)PyFF_Glyph_set_lcarets, + "The ligature caret locations, defined for this glyph, as a tuple.", NULL}, {"validation_state", (getter)PyFF_Glyph_get_validation_state, (setter)PyFF_cant_set, "glyph's validation state (readonly)", NULL}, diff --git a/fontforge/stamp.c b/fontforge/stamp.c index d32791dc..0fb4a981 100644 --- a/fontforge/stamp.c +++ b/fontforge/stamp.c @@ -1,5 +1,5 @@ #include <time.h> -const time_t source_modtime = 1298329534L; -const char *source_modtime_str = "23:05 GMT 21-Feb-2011"; -const char *source_version_str = "20110221"; +const time_t source_modtime = 1298382513L; +const char *source_modtime_str = "13:48 GMT 22-Feb-2011"; +const char *source_version_str = "20110222"; |