From f06a4edac993917c8b6a783d458ead31a83c53d6c1a24a8ef170c38eca65f664 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Wed, 1 Jul 2020 07:05:44 +0000 Subject: [PATCH] Accepting request 818037 from home:alarrosa:branches:M17N - Add patch to support transforming bitmap glyphs from python with one of the predefined transformations in fontforge. * add-bitmap-transform-support.patch (boo#1169444) - add support-sphinx3.patch and fix-glossary.patch to allow gh#fontforge/fontforge#4269 gh#fontforge/fontforge#4284 OBS-URL: https://build.opensuse.org/request/show/818037 OBS-URL: https://build.opensuse.org/package/show/M17N/fontforge?expand=0&rev=79 --- add-bitmap-transform-support.patch | 71 ++++++++++++++++++++++++++++++ fontforge.changes | 14 ++++-- fontforge.spec | 2 + 3 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 add-bitmap-transform-support.patch diff --git a/add-bitmap-transform-support.patch b/add-bitmap-transform-support.patch new file mode 100644 index 0000000..1a10ae1 --- /dev/null +++ b/add-bitmap-transform-support.patch @@ -0,0 +1,71 @@ +From: Antonio Larrosa +Subject: Add support to use bitmap font transformations from python + +This is needed by ttf-converter/xorg-x11-fonts in order to generate +an Italic version of MUTT-ClearlyU-Wide at package build time. + +Index: fontforge-20200314/fontforge/python.c +=================================================================== +--- fontforge-20200314.orig/fontforge/python.c ++++ fontforge-20200314/fontforge/python.c +@@ -35,6 +35,7 @@ + #include "autotrace.h" + #include "autowidth2.h" + #include "bitmapcontrol.h" ++#include "bvedit.h" + #include "cvexport.h" + #include "cvimages.h" + #include "cvundoes.h" +@@ -11933,6 +11934,44 @@ return( -1 ); + return( 0 ); + } + ++static PyObject *PyFFFont_bitmapTransform(PyFF_Font *self, PyObject *args) { ++ SplineFont *sf = self->fv->sf; ++ BDFFont *bdf; ++ char *funcname; ++ int xoff, yoff, i; ++ enum bvtools type; ++ ++ if ( CheckIfFontClosed(self) ) ++ return( NULL ); ++ ++ if ( !PyArg_ParseTuple(args,"sii", &funcname, &xoff, &yoff)) ++ return( NULL ); ++ ++ if (strcmp(funcname, "fliph") == 0) ++ type = bvt_fliph; ++ else if (strcmp(funcname, "flipv") == 0) ++ type = bvt_flipv; ++ else if (strcmp(funcname, "rotate90cw") == 0) ++ type = bvt_rotate90cw; ++ else if (strcmp(funcname, "rotate90ccw") == 0) ++ type = bvt_rotate90ccw; ++ else if (strcmp(funcname, "rotate180") == 0) ++ type = bvt_rotate180; ++ else if (strcmp(funcname, "skew") == 0) ++ type = bvt_skew; ++ else if (strcmp(funcname, "transmove") == 0) ++ type = bvt_transmove; ++ else Py_RETURN( self ); ++ ++ for ( bdf=sf->bitmaps; bdf!=NULL; bdf=bdf->next ) ++ for ( i=0; iglyphcnt; ++i ) ++ if ( bdf->glyphs[i]!=NULL ) ++ BCTransFunc(bdf->glyphs[i], type, xoff, yoff); ++ ++Py_RETURN( self ); ++} ++ ++ + static PyObject *PyFF_Font_get_bitmapSizes(PyFF_Font *self, void *UNUSED(closure)) { + PyObject *tuple; + int cnt; +@@ -18179,6 +18218,7 @@ Py_RETURN( self ); + + PyMethodDef PyFF_Font_methods[] = { + { "appendSFNTName", (PyCFunction) PyFFFont_appendSFNTName, METH_VARARGS, "Adds or replaces a name in the sfnt 'name' table. Takes three arguments, a language, a string id, and the string value" }, ++ { "bitmapTransform", (PyCFunction) PyFFFont_bitmapTransform, METH_VARARGS, "Transforms all bitmap glyphs."}, + { "close", (PyCFunction) PyFFFont_close, METH_NOARGS, "Frees up memory for the current font. Any python pointers to it will become invalid." }, + { "compareFonts", (PyCFunction) PyFFFont_compareFonts, METH_VARARGS, "Compares two fonts and stores the result into a file"}, + { "save", (PyCFunction) PyFFFont_Save, METH_VARARGS, "Save the current font to a sfd file" }, diff --git a/fontforge.changes b/fontforge.changes index c0c218e..bde1145 100644 --- a/fontforge.changes +++ b/fontforge.changes @@ -1,10 +1,18 @@ +------------------------------------------------------------------- +Mon Jun 29 11:27:50 UTC 2020 - Antonio Larrosa + +- Add patch to support transforming bitmap glyphs from python + with one of the predefined transformations in fontforge. + * add-bitmap-transform-support.patch + (boo#1169444) + ------------------------------------------------------------------- Mon May 25 19:11:37 UTC 2020 - Benjamin Greiner -- add support-sphinx3.patch and fix-glossary.patch to allow +- add support-sphinx3.patch and fix-glossary.patch to allow python-Sphinx >= 3 - gh#fontforge/fontforge#4269 - gh#fontforge/fontforge#4284 + gh#fontforge/fontforge#4269 + gh#fontforge/fontforge#4284 ------------------------------------------------------------------- Wed Apr 15 18:30:12 UTC 2020 - Antonio Larrosa diff --git a/fontforge.spec b/fontforge.spec index cf5c7c5..ea42109 100644 --- a/fontforge.spec +++ b/fontforge.spec @@ -35,6 +35,7 @@ Patch2: fix-sphinx-doc.patch Patch3: support-sphinx3.patch # taken from gh#fontforge/fontforge#4284 Patch4: fix-glossary.patch +Patch5: add-bitmap-transform-support.patch BuildRequires: cairo-devel BuildRequires: cmake BuildRequires: fdupes @@ -108,6 +109,7 @@ to develop applications that use FontForge libraries. %endif %patch3 -p1 %patch4 -p1 +%patch5 -p1 %build %cmake \