Skip to content
Browse files

Yet another patch I trampled on. Restore it.

  • Loading branch information...
1 parent 15aefd9 commit 9ec8bff88ac76c3f753b85ac4c364a9cd72c61aa George Williams committed
Showing with 77 additions and 6 deletions.
  1. +3 −3 fontforge/libffstamp.h
  2. +71 −0 fontforge/python.c
  3. +3 −3 fontforge/stamp.c
View
6 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 */
View
71 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},
View
6 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";

0 comments on commit 9ec8bff

Please sign in to comment.
Something went wrong with that request. Please try again.