import fontforge-20200314-5.el8

This commit is contained in:
CentOS Sources 2021-05-18 03:02:19 -04:00 committed by Andrew Lukoshko
parent d7328f7488
commit 01ed25b519
11 changed files with 251 additions and 3417 deletions

View File

@ -1,2 +1 @@
f7afd824640ed620790a20b14eb78b1e230fea10 SOURCES/fontforge-20170731.tar.gz
13b702314f26b56b81dc55adfe29468957002141 SOURCES/gnulib-2bf7326.tar.gz
cca54440dd47414055507a5007cd9b663699f3e2 SOURCES/fontforge-20200314.tar.gz

3
.gitignore vendored
View File

@ -1,2 +1 @@
SOURCES/fontforge-20170731.tar.gz
SOURCES/gnulib-2bf7326.tar.gz
SOURCES/fontforge-20200314.tar.gz

View File

@ -1,519 +0,0 @@
From b2c5de7835a753cad1f35db8202c4733b5fc2990 Mon Sep 17 00:00:00 2001
From: Parag A Nemade <pnemade@fedoraproject.org>
Date: Mon, 3 Oct 2016 12:56:29 +0530
Subject: [PATCH] Add python3 support
Signed-off-by: Parag A Nemade <pnemade@fedoraproject.org>
---
pycontrib/FontCompare/fc/BitmapHandler.py | 20 +++++++--------
pycontrib/FontCompare/fc/DocCompare.py | 2 +-
pycontrib/FontCompare/fc/FontCompare.py | 2 +-
pycontrib/FontCompare/fc/GlyphConsistency.py | 2 +-
pycontrib/FontCompare/fontcompare | 2 +-
pycontrib/FontCompare/unittests/unittests.py | 18 ++++++-------
pycontrib/collab/web-test-collab.py | 2 +-
pycontrib/even.py | 2 +-
pycontrib/gdraw/__init__.py | 4 +--
pycontrib/gdraw/gdraw.py | 20 +++++++--------
pycontrib/graphicore.py | 4 +--
pycontrib/graphicore/ipython_view.py | 13 +++++-----
pycontrib/graphicore/shell.py | 4 +--
pycontrib/svg2sfd.py | 38 ++++++++++++++--------------
pycontrib/webcollab.py | 6 ++---
15 files changed, 70 insertions(+), 69 deletions(-)
diff --git a/pycontrib/FontCompare/fc/BitmapHandler.py b/pycontrib/FontCompare/fc/BitmapHandler.py
index d4d00da..c159128 100644
--- a/pycontrib/FontCompare/fc/BitmapHandler.py
+++ b/pycontrib/FontCompare/fc/BitmapHandler.py
@@ -35,7 +35,7 @@ def white_bg_square(img):
"return a white-background-color image having the img in exact center"
size = (max(img.size),)*2
layer = Image.new('1', size, 1)
- layer.paste(img, tuple(map(lambda x:(x[0]-x[1])/2, zip(size, img.size))))
+ layer.paste(img, tuple([(x[0]-x[1])/2 for x in zip(size, img.size)]))
return layer
class BitmapCompare:
@@ -73,13 +73,13 @@ class CreateSpriteSheet:
#seperate each image with lots of whitespace
master_height = pixelsize
oldfont = font
- print "the master image will by %d by %d" % (master_width, master_height)
- print "creating image..."
+ print("the master image will by %d by %d" % (master_width, master_height))
+ print("creating image...")
master = Image.new(
mode='1',
size=(master_width, master_height),
color=0) # fully transparent
- print "created."
+ print("created.")
if effects == "italic":
font.selection.all()
font = font.italicize(-13)
@@ -92,16 +92,16 @@ class CreateSpriteSheet:
font[i].changeWeight(50,"auto",0,0,"auto")
font[i].export("temp.bmp",pixelsize,1)
img = Image.open("temp.bmp")
- print "adding %s at %d..." % (str(i)+".bmp", location),
+ print("adding %s at %d..." % (str(i)+".bmp", location), end=' ')
square_one = white_bg_square(img)
square_one.resize((pixelsize, pixelsize))
master.paste(square_one,(location,0))
- print "added."
+ print("added.")
except:
- print "ooopsy"
+ print("ooopsy")
count+=1
- print "done adding pics."
- print "saving mastersprite.bmp..."
+ print("done adding pics.")
+ print("saving mastersprite.bmp...")
master.save('data/mastersprite'+effects+'.bmp' )
- print "saved!"
+ print("saved!")
font.close()
diff --git a/pycontrib/FontCompare/fc/DocCompare.py b/pycontrib/FontCompare/fc/DocCompare.py
index 3a54bf9..df431e2 100644
--- a/pycontrib/FontCompare/fc/DocCompare.py
+++ b/pycontrib/FontCompare/fc/DocCompare.py
@@ -41,7 +41,7 @@ class DocCompare:
bashcommand = "hb-view --output-format=\"png\" --output-file=\"/var/tmp/test.png\" --font-size="+str(fontsize)+" --text-file=\""
bashcommand+=docpath+"\" "+"\""+testpath+"\""
os.system(str(bashcommand))
- print bashcommand
+ print(bashcommand)
thefile = pkg_resources.resource_filename("fc",mockfont.highresdocfile)
shutil.copy(thefile,"/var/tmp/standard.png")
cm = BitmapCompare()
diff --git a/pycontrib/FontCompare/fc/FontCompare.py b/pycontrib/FontCompare/fc/FontCompare.py
index f21718c..c82b788 100644
--- a/pycontrib/FontCompare/fc/FontCompare.py
+++ b/pycontrib/FontCompare/fc/FontCompare.py
@@ -111,7 +111,7 @@ class FontCompare(object):
scores = list()
comparator = BitmapCompare()
pixelsize = (resolution*ptsize)/72
- print spritepath
+ print(spritepath)
for i in range (glyphRange[0],glyphRange[1]):
if i in Testfont:
Testfont[i].export("/var/tmp/tmp.bmp",pixelsize,1)
diff --git a/pycontrib/FontCompare/fc/GlyphConsistency.py b/pycontrib/FontCompare/fc/GlyphConsistency.py
index 38273c9..d5265fa 100644
--- a/pycontrib/FontCompare/fc/GlyphConsistency.py
+++ b/pycontrib/FontCompare/fc/GlyphConsistency.py
@@ -102,7 +102,7 @@ class GlyphConsistency:
for i in range (glyphrange[0],glyphrange[1]):
if i in font:
score = self.glyph_round_compare(font[i],pixelsize)
- print score
+ print(score)
set_round_score+=score
total+=1
font.close()
diff --git a/pycontrib/FontCompare/fontcompare b/pycontrib/FontCompare/fontcompare
index e7e68d8..fdf7336 100755
--- a/pycontrib/FontCompare/fontcompare
+++ b/pycontrib/FontCompare/fontcompare
@@ -15,7 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-#! /usr/bin/python
+#! /usr/bin/python3
from PyQt4.QtGui import QMessageBox
from PyQt4.QtGui import QMainWindow
from PyQt4.QtGui import QApplication
diff --git a/pycontrib/FontCompare/unittests/unittests.py b/pycontrib/FontCompare/unittests/unittests.py
index 18e1e95..d8a1190 100644
--- a/pycontrib/FontCompare/unittests/unittests.py
+++ b/pycontrib/FontCompare/unittests/unittests.py
@@ -55,7 +55,7 @@ class Basictests(unittest.TestCase):
for tup in basic:
if tup[1]!=10:
bastest=0
- self.failUnless(bastest)
+ self.assertTrue(bastest)
testfont = fontforge.open("unittests/lohit.ttf")
bold = cm.font_facecompare(testfont,mockfont,(0x900,0x97f),\
600,12,1,"bold")
@@ -66,28 +66,28 @@ class Basictests(unittest.TestCase):
normal = cm.font_facecompare(testfont,mockfont,(0x900,0x97f),\
600,12,1,"normal")
test = 1
- print len(normal)
+ print(len(normal))
for tup in bold:
if tup[1]==100 or tup[1]==0:
test1=1
break
- self.failUnless(test)
+ self.assertTrue(test)
test = 0
for tup in italic:
if tup[1]==100 or tup[1]==0:
test=1
break
- self.failUnless(test is 1)
+ self.assertTrue(test is 1)
test = 0
for tup in normal:
if tup[1]==100 or tup[1]==0:
test=1
break
- self.failUnless(test is 1)
+ self.assertTrue(test is 1)
test = 0
if len(normal) == len(bold) == len(italic):
test = 1
- self.failUnless(test is 1)
+ self.assertTrue(test is 1)
def testGlyphConsistency(self):
cm = GlyphConsistency()
@@ -99,11 +99,11 @@ class Basictests(unittest.TestCase):
test3 = cm.glyph_round_consistency(testfont,(0x900,0x97f),50)
test = (0 <= test1[0][1] <= 10)
- self.failUnless(test)
+ self.assertTrue(test)
test2 = (0 <= test2 <= 10)
- self.failUnless(test2)
+ self.assertTrue(test2)
test3 = (0 <= test3 <= 10)
- self.failUnless(test3)
+ self.assertTrue(test3)
"""
unittests for DocCompare not required.
diff --git a/pycontrib/collab/web-test-collab.py b/pycontrib/collab/web-test-collab.py
index 47b763f..b19f930 100755
--- a/pycontrib/collab/web-test-collab.py
+++ b/pycontrib/collab/web-test-collab.py
@@ -68,7 +68,7 @@ def OnCollabUpdate(f):
"end": "null" # this is simply so we dont have to manage keeping the last item with no terminating ,
},
sort_keys=True, indent=4, separators=(',', ': '))
- print js
+ print(js)
fi = open(fontJsonOnDisk, 'w')
fi.write(js)
diff --git a/pycontrib/even.py b/pycontrib/even.py
index 96f9128..4f30fcb 100755
--- a/pycontrib/even.py
+++ b/pycontrib/even.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
running even from the fontforge menu
diff --git a/pycontrib/gdraw/__init__.py b/pycontrib/gdraw/__init__.py
index d47976c..dde7ea8 100644
--- a/pycontrib/gdraw/__init__.py
+++ b/pycontrib/gdraw/__init__.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# vim:ts=8:sw=4:expandtab:encoding=utf-8
'''
Copyright <hashao2@gmail.com> 2009
@@ -22,7 +22,7 @@ Copyright <hashao2@gmail.com> 2009
__all__ = ['Timer', 'GtkRunner', 'gtkrunner']
__version__ = '0.1'
-from gdraw import *
+from .gdraw import *
def main():
pass
diff --git a/pycontrib/gdraw/gdraw.py b/pycontrib/gdraw/gdraw.py
index f2d5e50..8b6e693 100755
--- a/pycontrib/gdraw/gdraw.py
+++ b/pycontrib/gdraw/gdraw.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
'''ctypes wrapper to Attach the GDraw event handler to the gtk main loop.
Copyright <hashao2@gmail.com> 2009
@@ -67,7 +67,7 @@ def setup_syspath(modpath="modules"):
__all__ = ['Timer', 'GtkRunner', 'gtkrunner']
-from _gdraw import *
+from ._gdraw import *
from ctypes import *
import types
@@ -111,7 +111,7 @@ class Timer:
return
def dodo(*args):
- print 'aaa'
+ print('aaa')
return False
self.add(1000, dodo)
@@ -122,7 +122,7 @@ class Timer:
def _event_handler(self, gw, event):
evt = event.contents
- print "_event_handler()"
+ print("_event_handler()")
if evt.type == et_timer:
timer = evt.u.timer.timer
tkey = addressof(timer.contents)
@@ -147,7 +147,7 @@ class Timer:
ci.func = CallBackFunc(func)
ci.data = data
- print "timer.add timeout", timeout
+ print("timer.add timeout", timeout)
frequency = 1 # Use return value of func() to decide repeat like gtk.
timer = GDrawRequestTimer(self.win, timeout, timeout, byref(ci))
@@ -190,7 +190,7 @@ class GtkRunner:
def _do_main(self, *args):
'''The function called by the gdraw timeout handler.'''
- print "do_main"
+ print("do_main")
while gtk.events_pending():
gtk.main_iteration(False)
return True
@@ -207,15 +207,15 @@ class GtkRunner:
self.gtk_timer = None
def OnDestroyWindow(self, widget, fd ):
- print fd
+ print(fd)
fontforge.removeGtkWindowToMainEventLoopByFD( fd )
self.stop()
return True
def sniffwindow(self,w):
'''sniff key presses for a gtk window'''
- print "sniffwindow w", w
- print "sniff active font:", fontforge.activeFont()
+ print("sniffwindow w", w)
+ print("sniff active font:", fontforge.activeFont())
w.connect("key-release-event", self._do_main)
fontforge.addGtkWindowToMainEventLoop(w.window.xid)
fd = fontforge.getGtkWindowMainEventLoopFD(w.window.xid)
@@ -223,7 +223,7 @@ class GtkRunner:
def sniffwindowid(self,xid):
'''sniff key presses for a gtk window'''
- print "sniffwindowid xid", xid
+ print("sniffwindowid xid", xid)
#w.connect("key-release-event", self._do_main)
def start(self, timeout=GTIMEOUT):
diff --git a/pycontrib/graphicore.py b/pycontrib/graphicore.py
index f95e488..229a2b7 100755
--- a/pycontrib/graphicore.py
+++ b/pycontrib/graphicore.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
running the fontforge scripts in the graphicore folder on fontforge startup
@@ -22,4 +22,4 @@ sys.path.append(os.path.dirname(sys.modules[__name__].__file__))
sys.path.reverse();
#load the modules
-import graphicore.shell
\ No newline at end of file
+import graphicore.shell
diff --git a/pycontrib/graphicore/ipython_view.py b/pycontrib/graphicore/ipython_view.py
index f39eedb..2b77395 100644
--- a/pycontrib/graphicore/ipython_view.py
+++ b/pycontrib/graphicore/ipython_view.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
'''
Provides IPython console widget.
@@ -17,10 +17,11 @@ import re
import sys
import os
import pango
-from StringIO import StringIO
-import thread
+from io import StringIO
+import _thread
import IPython
+from functools import reduce
class IterableIPShell:
'''
@@ -118,7 +119,7 @@ class IterableIPShell:
'''
This function updates namespace with sys.modules
'''
- for k,v in sys.modules.items():
+ for k,v in list(sys.modules.items()):
if not '.' in k:
self.IP.user_ns.update({k:v})
@@ -271,11 +272,11 @@ class IterableIPShell:
@type header: string
'''
stat = 0
- if verbose or debug: print header+cmd
+ if verbose or debug: print(header+cmd)
# flush stdout so we don't mangle python's buffering
if not debug:
input, output = os.popen4(cmd)
- print output.read()
+ print(output.read())
output.close()
input.close()
diff --git a/pycontrib/graphicore/shell.py b/pycontrib/graphicore/shell.py
index 5d102f7..32fa584 100755
--- a/pycontrib/graphicore/shell.py
+++ b/pycontrib/graphicore/shell.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
FontForge Interactive Python Shell
@@ -32,7 +32,7 @@ if len(sys.argv) == 0:
# some versions of IPython need content in sys.argv
sys.argv.append('')
-from ipython_view import *
+from .ipython_view import *
import gdraw
def runShell(data = None, glyphOrFont = None):
diff --git a/pycontrib/svg2sfd.py b/pycontrib/svg2sfd.py
index e1fc0ac..e23cb15 100644
--- a/pycontrib/svg2sfd.py
+++ b/pycontrib/svg2sfd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#
# Copyright 2013 Google Inc. All rights reserved.
#
@@ -49,7 +49,7 @@ def print_one_cmd(cmd, args):
result.append('%f' % (scale * args[i]))
result.append(cmd)
result.append('0') # TODO: should mark corner points
- print ' '.join(result)
+ print(' '.join(result))
def apply_rel_xy(xy, args):
x0, y0 = xy
@@ -75,7 +75,7 @@ def path_to_sfd(path):
for i in range(num_args_cmd(cmd)):
m = fre.match(path)
if m is None:
- print 'no float match:', path
+ print('no float match:', path)
args.append(float(m.group(1)))
path = path[m.end():]
#print cmd, args
@@ -128,13 +128,13 @@ def conv_svg(fn, char, glyphnum = None):
if glyphnum == None:
glyphnum = lastglyphnum + 1
lastglyphnum = glyphnum
- print 'StartChar:', os.path.basename(fn)[:-4]
- print 'Encoding: %d %d %d' % (char, glyphnum, char)
- print 'Width: %d' % (21 * 40)
- print 'Flags: W'
- print 'LayerCount: 2'
- print 'Fore'
- print 'SplineSet'
+ print('StartChar:', os.path.basename(fn)[:-4])
+ print('Encoding: %d %d %d' % (char, glyphnum, char))
+ print('Width: %d' % (21 * 40))
+ print('Flags: W')
+ print('LayerCount: 2')
+ print('Fore')
+ print('SplineSet')
doc = xml.dom.minidom.parse(fn)
# TODO: reverse paths if fill color is white-ish (this is more code,
# and in the meantime, we'll rely on correct path direction in FF)
@@ -147,16 +147,16 @@ def conv_svg(fn, char, glyphnum = None):
cy = float(circle.getAttribute('cy'))
r = float(circle.getAttribute('r'))
circle_to_sfd(cx, cy, r)
- print 'EndSplineSet'
- print 'EndChar'
+ print('EndSplineSet')
+ print('EndChar')
def print_header():
global header_printed
- print '''SplineFontDB: 3.0
+ print('''SplineFontDB: 3.0
FontName: %s
FullName: %s
-FamilyName: %s''' % (font_name, font_name, font_name)
- print '''Weight: Medium
+FamilyName: %s''' % (font_name, font_name, font_name))
+ print('''Weight: Medium
Copyright: Copyright (C) 2011 Google Inc.
Version: 001.000
UnderlinePosition: -120
@@ -180,12 +180,12 @@ HheadAOffset: 0
HheadDescent: 200
HheadDOffset: 0
BeginChars: 57600 57600
-'''
+''')
header_printed = True
def print_footer():
- print '''EndChars
-EndSplineFont'''
+ print('''EndChars
+EndSplineFont''')
def parse_int(x):
if x.startswith('0x'):
@@ -197,7 +197,7 @@ def run_file(fn):
global char_num
global font_name
directory = ''
- for l in file(fn).xreadlines():
+ for l in file(fn):
if l.startswith('#'):
continue
s = l.strip().split()
diff --git a/pycontrib/webcollab.py b/pycontrib/webcollab.py
index 9ee0f17..4be07ec 100755
--- a/pycontrib/webcollab.py
+++ b/pycontrib/webcollab.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
running web collab server hooks
@@ -44,8 +44,8 @@ def startWebServerInCollabMode(data = None, glyphOrFont = None):
global child
global childNodejs
ensureChildClosed()
- print("FONTFORGE:" + FONTFORGE)
- print("script path:" + collabpath + "web-test-collab.py")
+ print(("FONTFORGE:" + FONTFORGE))
+ print(("script path:" + collabpath + "web-test-collab.py"))
child = subprocess.Popen( [ FONTFORGE, "-forceuihidden", "-script", collabpath + "web-test-collab.py" ] )
#
# start the nodejs server
--
2.9.3

View File

@ -1,30 +0,0 @@
--- ./Makefile.am.old 2014-08-12 10:07:32.000000000 +0530
+++ ./Makefile.am 2014-09-08 16:23:56.046996941 +0530
@@ -43,7 +43,6 @@
AM_CPPFLAGS =
AM_LDFLAGS =
-BUILT_SOURCES = uthash/src
EXTRA_DIST =
CLEANFILES =
MOSTLYCLEANFILES =
@@ -113,7 +112,6 @@
Packaging/FontForge-doc.spec \
Packaging/FontForge.spec \
Packaging/FontForge.static.spec \
- uthash/src \
$(NULL)
#--------------------------------------------------------------------------
@@ -129,11 +127,6 @@
#--------------------------------------------------------------------------
-uthash/src:
- if [ ! -e uthash/src ]; then \
- if [ -e uthash ] ; then rm -r uthash ; fi ; \
- git clone https://github.com/troydhanson/uthash ; \
- fi ;
# We import a selection of targets from Frank's standard packaging Makefile.

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +0,0 @@
From b96273acc691ac8a36c6a8dd4de8e6edd7eaae59 Mon Sep 17 00:00:00 2001
From: Fredrick Brennan <copypaste@kittens.ph>
Date: Tue, 21 Jan 2020 15:16:00 +0800
Subject: [PATCH] Fix crash on exit introduced in previous commit
When the number of layers is greater than 2, as in Chomsky.sfd and most
of my other fonts, FontForge will crash on exiting.
This is just a simple mistake @skef made.
---
fontforge/sfd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fontforge/sfd.c b/fontforge/sfd.c
index e8ca39ba83..9517d8cb12 100644
--- a/fontforge/sfd.c
+++ b/fontforge/sfd.c
@@ -7998,9 +7998,9 @@ bool SFD_GetFontMetaData( FILE *sfd,
int layer_cnt_tmp;
getint(sfd,&layer_cnt_tmp);
if ( layer_cnt_tmp>2 ) {
+ sf->layer_cnt = layer_cnt_tmp;
sf->layers = realloc(sf->layers,sf->layer_cnt*sizeof(LayerInfo));
memset(sf->layers+2,0,(sf->layer_cnt-2)*sizeof(LayerInfo));
- sf->layer_cnt = layer_cnt_tmp;
}
}
else if ( strmatch(tok,"Layer:")==0 )

View File

@ -1,78 +0,0 @@
From 048a91e2682c1a8936ae34dbc7bd70291ec05410 Mon Sep 17 00:00:00 2001
From: Skef Iterum <unknown>
Date: Mon, 6 Jan 2020 03:05:06 -0800
Subject: [PATCH] Fix for #4084 Use-after-free (heap) in the
SFD_GetFontMetaData() function Fix for #4086 NULL pointer dereference in the
SFDGetSpiros() function Fix for #4088 NULL pointer dereference in the
SFD_AssignLookups() function Add empty sf->fontname string if it isn't set,
fixing #4089 #4090 and many other potential issues (many downstream calls
to strlen() on the value).
---
fontforge/sfd.c | 19 ++++++++++++++-----
fontforge/sfd1.c | 2 +-
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/fontforge/sfd.c b/fontforge/sfd.c
index 731be201e0..e8ca39ba83 100644
--- a/fontforge/sfd.c
+++ b/fontforge/sfd.c
@@ -4032,13 +4032,16 @@ static void SFDGetSpiros(FILE *sfd,SplineSet *cur) {
while ( fscanf(sfd,"%lg %lg %c", &cp.x, &cp.y, &cp.ty )==3 ) {
if ( cur!=NULL ) {
if ( cur->spiro_cnt>=cur->spiro_max )
- cur->spiros = realloc(cur->spiros,(cur->spiro_max+=10)*sizeof(spiro_cp));
+ cur->spiros = realloc(cur->spiros,
+ (cur->spiro_max+=10)*sizeof(spiro_cp));
cur->spiros[cur->spiro_cnt++] = cp;
}
}
- if ( cur!=NULL && (cur->spiros[cur->spiro_cnt-1].ty&0x7f)!=SPIRO_END ) {
+ if ( cur!=NULL && cur->spiro_cnt>0
+ && (cur->spiros[cur->spiro_cnt-1].ty&0x7f)!=SPIRO_END ) {
if ( cur->spiro_cnt>=cur->spiro_max )
- cur->spiros = realloc(cur->spiros,(cur->spiro_max+=1)*sizeof(spiro_cp));
+ cur->spiros = realloc(cur->spiros,
+ (cur->spiro_max+=1)*sizeof(spiro_cp));
memset(&cur->spiros[cur->spiro_cnt],0,sizeof(spiro_cp));
cur->spiros[cur->spiro_cnt++].ty = SPIRO_END;
}
@@ -7992,10 +7995,12 @@ bool SFD_GetFontMetaData( FILE *sfd,
else if ( strmatch(tok,"LayerCount:")==0 )
{
d->had_layer_cnt = true;
- getint(sfd,&sf->layer_cnt);
- if ( sf->layer_cnt>2 ) {
+ int layer_cnt_tmp;
+ getint(sfd,&layer_cnt_tmp);
+ if ( layer_cnt_tmp>2 ) {
sf->layers = realloc(sf->layers,sf->layer_cnt*sizeof(LayerInfo));
memset(sf->layers+2,0,(sf->layer_cnt-2)*sizeof(LayerInfo));
+ sf->layer_cnt = layer_cnt_tmp;
}
}
else if ( strmatch(tok,"Layer:")==0 )
@@ -8948,6 +8953,10 @@ exit( 1 );
}
}
+ // Many downstream functions assume this isn't NULL (use strlen, etc.)
+ if ( sf->fontname==NULL)
+ sf->fontname = copy("");
+
if ( fromdir )
sf = SFD_FigureDirType(sf,tok,dirname,enc,remap,had_layer_cnt);
else if ( sf->subfontcnt!=0 ) {
diff --git a/fontforge/sfd1.c b/fontforge/sfd1.c
index cf931059d0..b42f832678 100644
--- a/fontforge/sfd1.c
+++ b/fontforge/sfd1.c
@@ -674,7 +674,7 @@ void SFD_AssignLookups(SplineFont1 *sf) {
/* Fix up some gunk from really old versions of the sfd format */
SFDCleanupAnchorClasses(&sf->sf);
- if ( sf->sf.uni_interp==ui_unset )
+ if ( sf->sf.uni_interp==ui_unset && sf->sf.map!=NULL )
sf->sf.uni_interp = interp_from_encoding(sf->sf.map->enc,ui_none);
/* Fixup for an old bug */

View File

@ -1,12 +0,0 @@
diff -urN fontforge-20170731.old/fontforge/Makefile.am fontforge-20170731/fontforge/Makefile.am
--- fontforge-20170731.old/fontforge/Makefile.am 2017-07-31 03:19:01.000000000 +0530
+++ fontforge-20170731/fontforge/Makefile.am 2019-06-01 23:35:57.644257299 +0530
@@ -192,7 +192,7 @@
# without optimization.
splinerefigure.lo: $(srcdir)/splinerefigure.c $(srcdir)/splinefont.h
$(LIBTOOL) --mode=compile $(CC) $(RAW_COMPILE_PLATFORM_CFLAGS) -g -c -o \
- splinerefigure.lo $(AM_CPPFLAGS) $(srcdir)/splinerefigure.c
+ splinerefigure.lo $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/splinerefigure.c
#--------------------------------------------------------------------------
EXTRA_DIST = generate_codepoint_selector.py threaddummy.c

View File

@ -0,0 +1,27 @@
From ee14a6389d19e2f45219134058e07f10585fa6d3 Mon Sep 17 00:00:00 2001
From: Jeremy Tan <jtanx@outlook.com>
Date: Thu, 2 Apr 2020 18:03:47 +0800
Subject: [PATCH] Call gdk_set_allowed_backends before gdk_init
Fixes #4247
---
fontforgeexe/startui.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fontforgeexe/startui.c b/fontforgeexe/startui.c
index 06f5200a4..114bb7fb6 100644
--- a/fontforgeexe/startui.c
+++ b/fontforgeexe/startui.c
@@ -1182,8 +1182,8 @@ int fontforge_main( int argc, char **argv ) {
#endif
}
#ifdef FONTFORGE_CAN_USE_GDK
- gdk_init(&argc, &argv);
gdk_set_allowed_backends("win32,quartz,x11");
+ gdk_init(&argc, &argv);
#endif
ensureDotFontForgeIsSetup();
#if defined(__MINGW32__) && !defined(_NO_LIBCAIRO)
--
2.26.0

View File

@ -0,0 +1,161 @@
From 1a03ca2de0b4c99ee72b330b56e89cc90fe773ae Mon Sep 17 00:00:00 2001
From: Jeremy Tan <jtanx@outlook.com>
Date: Sat, 4 Apr 2020 11:43:34 +1100
Subject: [PATCH] Minor changes for backwards compatibility with older versions
of Sphinx
Closes #4256
---
doc/sphinx/conf.py | 3 +++
doc/sphinx/techref/splinefont.rst | 26 ++++++++++++-------------
doc/sphinx/ui/misc/fontforge-themes.rst | 2 +-
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py
index 4b22e2eaf6..f2df68676e 100644
--- a/doc/sphinx/conf.py
+++ b/doc/sphinx/conf.py
@@ -68,6 +68,9 @@
# Don't copy source rst files into the output
html_copy_source = False
+# Set the main page
+master_doc = 'index'
+
# Custom roles must be in the prolog, not the epilog!
rst_prolog = '''
.. role:: small
diff --git a/doc/sphinx/techref/splinefont.rst b/doc/sphinx/techref/splinefont.rst
index 98248f7a5e..60399d3912 100644
--- a/doc/sphinx/techref/splinefont.rst
+++ b/doc/sphinx/techref/splinefont.rst
@@ -195,7 +195,7 @@ The bounding box of a :ref:`Spline <splinefont.Spline>`,
:ref:`SplineChar <splinefont.SplineChar>`, :ref:`RefChar <splinefont.RefChar>`,
:ref:`Image <splinefont.ImageList>`, or whatever else needs a bounding box.
-.. code-block::
+.. code-block:: default
:name: splinefont.BDFFloat
typedef struct bdffloat {
@@ -206,7 +206,7 @@ The bounding box of a :ref:`Spline <splinefont.Spline>`,
The floating selection in a :ref:`BDFChar <splinefont.BDFChar>`.
-.. code-block::
+.. code-block:: default
:name: splinefont.Undoes
typedef struct undoes {
@@ -277,7 +277,7 @@ both the splines and the bitmaps of a character.
ut_mult is used when doing a copy from the FontView where you are copying more
than one character.
-.. code-block::
+.. code-block:: default
:name: splinefont.BDFChar
typedef struct bdfchar {
@@ -318,7 +318,7 @@ represented by a byte rather than a bit. There is a clut for this in the BDFFont
The last thing in the BDFChar is a (/an optional) floating selection. Only
present if the user has made a selection or done a paste or something like that.
-.. code-block::
+.. code-block:: default
:name: splinefont.BDFFont
typedef struct bdffont {
@@ -345,7 +345,7 @@ contains a count of the number of entries in the array, and then the array
itself. Currently the number of entries here is always 16, but that could
change.
-.. code-block::
+.. code-block:: default
:name: splinefont.SplinePoint
enum pointtype { pt_curve, pt_corner, pt_tangent };
@@ -405,7 +405,7 @@ drawing it. They are cached so they don't need to be regenerated each time.
There's a different set of lines for every scale (as there is a different amount
of visible detail). They get freed and regenerated if the Spline changes.
-.. code-block::
+.. code-block:: default
:name: splinefont.Spline
typedef struct spline1d {
@@ -439,7 +439,7 @@ some are used in other places too.
The Spline1D structures give the equations for the x and y coordinates
respectively (splines[0] is for x, splines[1] is for y).
-.. code-block::
+.. code-block:: default
:name: splinefont.SplinePointList
typedef struct splinepointlist {
@@ -463,7 +463,7 @@ to). A SplinePointList is a connected path. There are three cases:
Generally a series of paths will make up a character, and they are linked
together on the next field.
-.. code-block::
+.. code-block:: default
:name: splinefont.RefChar
typedef struct refchar {
@@ -498,7 +498,7 @@ themselves). The selected field indicates that the reference is selected. The bb
field provides a transformed bounding box. And the sc field points to the
SplineChar we are referring to.
-.. code-block::
+.. code-block:: default
:name: splinefont.KernPair
typedef struct kernpair {
@@ -514,7 +514,7 @@ offset between them (or rather the difference from what their respective left
and right bearings would lead you to believe it should be). Next points to the
next kernpair.
-.. code-block::
+.. code-block:: default
:name: splinefont.Hints
typedef struct hints {
@@ -532,7 +532,7 @@ y space) of where the stem starts, and width is how long it is. Width may be
negative (in which case base is where the stem ends). Next points to the next
hint for the character.
-.. code-block::
+.. code-block:: default
:name: splinefont.ImageList
typedef struct imagelist {
@@ -551,7 +551,7 @@ not support any other transformations on images). The bounding box is after the
transformations have been applied. The next field points to the next image, and
selected indicates whether this one is selected or not.
-.. code-block::
+.. code-block:: default
:name: splinefont.SplineChar
typedef struct splinechar {
@@ -623,7 +623,7 @@ follow this one. For instance the combination "VA" might need kerning, then the
SplineChar representing "V" would have a pointer to a
:ref:`KernPair <splinefont.KernPair>` with data on "A".
-.. code-block::
+.. code-block:: default
:name: splinefont.SplineFont
typedef struct splinefont {
diff --git a/doc/sphinx/ui/misc/fontforge-themes.rst b/doc/sphinx/ui/misc/fontforge-themes.rst
index 8df505634f..5bf3f6edd5 100644
--- a/doc/sphinx/ui/misc/fontforge-themes.rst
+++ b/doc/sphinx/ui/misc/fontforge-themes.rst
@@ -4,7 +4,7 @@ FontForge color schemes
The following are some suggestions for color schemes. You simply copy these into
your ~/.Xdefaults file and then run
-.. code-block::
+.. code-block:: default
:name: fontforge-themes.shell
$ xrdb ~/.Xdefaults

View File

@ -1,34 +1,26 @@
%global gettext_package FontForge
%global gnulib_githead 2bf7326
%global gittag0 20170731
%global gittag0 20200314
Name: fontforge
Version: %{gittag0}
Release: 15%{?dist}
Version: 20200314
Release: 5%{?dist}
Summary: Outline and bitmap font editor
License: GPLv3+
URL: http://fontforge.github.io/
Source0: https://github.com/fontforge/%{name}/archive/%{gittag0}.tar.gz#/%{name}-%{version}.tar.gz
# https://github.com/fontforge/fontforge/issues/1725
Source1: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=snapshot;h=%{gnulib_githead};sf=tgz;name=gnulib-%{gnulib_githead}.tar.gz
# https://github.com/fontforge/fontforge/pull/1723
Patch0: fontforge-20140813-use-system-uthash.patch
# Fedora specific patch to have python3 support only
Patch1: Add-python3-support.patch
Patch2: fontforge-20170731-covscan-issue-fix.patch
Patch3: fontforge-20170731-override-upstream-optimization-flags-splinerefigure-c.patch
# https://github.com/fontforge/fontforge/issues/4084
Patch4: fontforge-20170731-cve-2020-5395.patch
# https://github.com/fontforge/fontforge/issues/4164
Patch5: fontforge-20170731-cve-2020-5395-followup-fix.patch
# https://github.com/fontforge/fontforge/pull/4253
Patch0: fontforge-20200314-Call-gdk_set_allowed_backends-before-gdk_init.patch
# https://github.com/fontforge/fontforge/pull/4257
Patch1: fontforge-20200314-minor-backward-compatible-sphinx-changes.patch
Requires: xdg-utils
Requires: autotrace
Requires: hicolor-icon-theme
BuildRequires: gcc
BuildRequires: git
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: libjpeg-devel
BuildRequires: libtiff-devel
BuildRequires: libpng-devel
@ -44,16 +36,13 @@ BuildRequires: pango-devel
BuildRequires: cairo-devel
BuildRequires: libspiro-devel
BuildRequires: python3-devel
BuildRequires: libtool-ltdl-devel
BuildRequires: libtool
BuildRequires: readline-devel
# This is failing on aarch64 so drop it
#BuildRequires: python-ipython
BuildRequires: uthash-devel
BuildRequires: libappstream-glib
# F25 build is failing add following to fix
BuildRequires: shared-mime-info
Provides: bundled(gnulib)
# F33 onward need now
BuildRequires: gtk3-devel
BuildRequires: python3-sphinx
%description
FontForge (former PfaEdit) is a font editor for outline and bitmap
@ -62,14 +51,13 @@ fonts. It supports a range of font formats, including PostScript
(Type2) and CID-keyed fonts.
%package devel
Summary: Development tools for fontforge
Requires: %{name} = %{version}-%{release}
Summary: Development files for fontforge
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-doc = %{version}-%{release}
Requires: pkgconfig
%description devel
This package includes the libraries and header files you will need
to compile applications against fontforge.
This package includes the library files you will need to compile
applications against fontforge.
%package doc
Summary: Documentation files for %{name}
@ -80,92 +68,88 @@ This package contains documentation files for %{name}.
%prep
%autosetup -p1
tar xzf %{SOURCE1}
%setup -q
%patch0 -p1
%patch1 -p1
sed -i -e '/^#!\//, 1d' pycontrib/webcollab.py
mkdir htdocs
cp -pr doc/html/* htdocs
chmod 644 htdocs/nonBMP/index.html
# Fix bad line terminators
%{__sed} -i 's/\r//' htdocs/Big5.txt
%{__sed} -i 's/\r//' htdocs/corpchar.txt
# Remove tests that requires Internet access
sed -i '45d;83d;101d;102d;114d;115d;125d' tests/CMakeLists.txt
rm tests/test003.pe tests/test130.pe tests/test0101.py tests/test929.py
# Remove tests for s390x
rm tests/test0004.py tests/test1009.py tests/test1010.py
# Remove desktop-file-validate warning
sed -i '5d' desktop/org.fontforge.FontForge.desktop
%build
./bootstrap --skip-git --gnulib-srcdir=gnulib-%{gnulib_githead}
rm -rf build && mkdir build
pushd build
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure PYTHON=python3
make V=1 %{?_smp_mflags}
%cmake .. -DCMAKE_BUILD_TYPE=Release
%{make_build}
popd
%install
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
rm -f $RPM_BUILD_ROOT%{_libdir}/libg{draw,unicode}.{la,so}
pushd build
%{make_install}
popd
desktop-file-install \
--dir $RPM_BUILD_ROOT%{_datadir}/applications \
--add-category X-Fedora \
desktop/fontforge.desktop
# The fontforge makefiles install htdocs as well, but we
# prefer to have them under the standard RPM location, so
# remove the extra copy
rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/fontforge
desktop/org.fontforge.FontForge.desktop
# remove unneeded .la and .a files
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
find $RPM_BUILD_ROOT -name '*.a' -exec rm -f {} ';'
rm -f %{buildroot}%{_datadir}/doc/fontforge/{.buildinfo,.nojekyll}
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml
# Find translations
%find_lang %{gettext_package}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/appdata
install -m 644 -p desktop/fontforge.appdata.xml $RPM_BUILD_ROOT%{_datadir}/appdata
mkdir -p $RPM_BUILD_ROOT%{_datadir}/mime/packages
install -m 644 -p desktop/fontforge.xml $RPM_BUILD_ROOT%{_datadir}/mime/packages/
#Makefile install rules are playing evil here. Let's correct the permission.
#chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/python/graphicore/__init__.py
chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/python/gdraw/_gdraw.py
chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/nodejs/collabwebview/css/*.css
chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/nodejs/collabwebview/js/*.js
chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/nodejs/collabwebview/js/contentEditable/*
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%check
pushd build
make check
popd
%files -f %{gettext_package}.lang
%doc AUTHORS
%license LICENSE
%license LICENSE COPYING.gplv3
%{_bindir}/*
%{_libdir}/lib*.so.*
%{_datadir}/applications/*fontforge.desktop
%{_datadir}/applications/*FontForge.desktop
%{_datadir}/fontforge
%{_datadir}/icons/hicolor/*/apps/fontforge.*
%{_datadir}/icons/hicolor/*/apps/org.fontforge.FontForge*
%{_mandir}/man1/*.1*
%{_datadir}/pixmaps/org.fontforge.FontForge*
%{_datadir}/mime/packages/fontforge.xml
%{_datadir}/appdata/fontforge.appdata.xml
%{_metainfodir}/org.fontforge.FontForge.appdata.xml
%{python3_sitearch}/fontforge.so
%{python3_sitearch}/psMat.so
%files devel
%{_includedir}/fontforge/
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc
%files doc
%doc htdocs
%doc %{_pkgdocdir}
%changelog
* Mon Dec 14 2020 Parag Nemade <pnemade AT redhat DOT com> - 20200314-5
- The %%find_lang should run as part of %%install only
* Mon Dec 07 2020 Parag Nemade <pnemade AT redhat DOT com> - 20200314-4
- Minor changes for backwards compatibility with older versions of Sphinx
Resolves: rhbz#1646212
* Wed Apr 08 2020 Parag Nemade <pnemade AT redhat DOT com> - 20170731-15
- Resolves:rh#1821664 - CVE-2020-5395:out-of-bounds write in sfd.c
- Resolves:rh#1821664 - out-of-bounds write in sfd.c
* Thu Jan 16 2020 Parag Nemade <pnemade AT redhat DOT com> - 20170731-14
- Resolves:rh#1790974 - CVE-2020-5395:out-of-bounds write in sfd.c
- Resolves:rh#1790974 - out-of-bounds write in sfd.c
* Sun Jun 02 2019 Parag Nemade <pnemade AT redhat DOT com> - 20170731-13
- Resolves:rh#1665940 - harden the missing splinerefigure.c file
@ -188,9 +172,6 @@ chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/nodejs/collabwebview/js/contentEd
* Sat Sep 22 2018 Parag Nemade <pnemade AT redhat DOT com> - 20170731-7
- Resolves:rh#1602497 - Fix some covscan issues
* Mon Jul 23 2018 Ray Strode <rstrode@redhat.com> - 20170731-6
- Drop gnulib BuildReq
* Sun Feb 11 2018 Sandro Mani <manisandro@gmail.com> - 20170731-5
- Rebuild (giflib)