Commit fd860782 authored by Kavya Manohar's avatar Kavya Manohar

Build script updated for GASP and xAvgCharWidth correction

Grid fitting table entries in sfd file modified accordingly
parent 882b7ced
Pipeline #8703325 passed with stages
in 3 minutes and 53 seconds
......@@ -21,7 +21,7 @@ OS2Version: 1
OS2_WeightWidthSlopeOnly: 0
OS2_UseTypoMetrics: 1
CreationTime: 1201144287
ModificationTime: 1496335035
ModificationTime: 1496335520
PfmFamily: 33
TTFWeight: 400
TTFWidth: 5
......@@ -60,7 +60,7 @@ MarkAttachClasses: 2
DEI: 91125
LangName: 1100 "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "+DS4NQA0w"
LangName: 1033 "" "" "" "" "" "7.0" "" "" "" "Hussain KH and Suresh P for Swathanthra Malayalam Computing (SMC)" "Meera font is a Malayalam font designed by Hussain K H and maintained by Swathanthra Malayalam Computing project. This is a comprehensive Malayalam font with 1000+- glyphs for all common Malayalam ligatures.+AAoACgAA-It has carefully designed ascend, descend metrics optimized for Malayalam script's vertically stacked conjuncts. Meera is even stroke typeface for better screen rendering, with individually designed glyphs for complex conjuncts rather than using component glyphs. The opentype rules used in this font later became a reference for many other Malayalam fonts.+AAoACgAA-Released in 2007, Meera is default Malayalam font for many GNU/Linux distros for Malayalam script. The font is widely used in web as the primary choice for Malayalam screen font. In 2016 Latin glyphs were added. The font is available only in regular style.+AAoACgAA-Source code is available at https://gitlab.com/smc/meera" "http://smc.org.in" "http://smc.org.in ; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]" "Digitized data copyright (c) 2007-2017 Hussain K H, Suresh P, Santhosh Thottingal, Rajeesh K Nambiar, Swathanthra Malayalam Computing (http://smc.org.in) with Reserved Font Name Meera.+AAoACgAA-This Font Software is licensed under the SIL Open Font License, Version 1.1.+AAoA-This license is copied below, and is also available with a FAQ at:+AAoA-http://scripts.sil.org/OFL+AAoACgAK------------------------------------------------------------+AAoA-SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+AAoA------------------------------------------------------------+AAoACgAA-PREAMBLE+AAoA-The goals of the Open Font License (OFL) are to stimulate worldwide+AAoA-development of collaborative font projects, to support the font creation+AAoA-efforts of academic and linguistic communities, and to provide a free and+AAoA-open framework in which fonts may be shared and improved in partnership+AAoA-with others.+AAoACgAA-The OFL allows the licensed fonts to be used, studied, modified and+AAoA-redistributed freely as long as they are not sold by themselves. The+AAoA-fonts, including any derivative works, can be bundled, embedded, +AAoA-redistributed and/or sold with any software provided that any reserved+AAoA-names are not used by derivative works. The fonts and derivatives,+AAoA-however, cannot be released under any other type of license. The+AAoA-requirement for fonts to remain under this license does not apply+AAoA-to any document created using the fonts or their derivatives.+AAoACgAA-DEFINITIONS+AAoAIgAA-Font Software+ACIA refers to the set of files released by the Copyright+AAoA-Holder(s) under this license and clearly marked as such. This may+AAoA-include source files, build scripts and documentation.+AAoACgAi-Reserved Font Name+ACIA refers to any names specified as such after the+AAoA-copyright statement(s).+AAoACgAi-Original Version+ACIA refers to the collection of Font Software components as+AAoA-distributed by the Copyright Holder(s).+AAoACgAi-Modified Version+ACIA refers to any derivative made by adding to, deleting,+AAoA-or substituting -- in part or in whole -- any of the components of the+AAoA-Original Version, by changing formats or by porting the Font Software to a+AAoA-new environment.+AAoACgAi-Author+ACIA refers to any designer, engineer, programmer, technical+AAoA-writer or other person who contributed to the Font Software.+AAoACgAA-PERMISSION & CONDITIONS+AAoA-Permission is hereby granted, free of charge, to any person obtaining+AAoA-a copy of the Font Software, to use, study, copy, merge, embed, modify,+AAoA-redistribute, and sell modified and unmodified copies of the Font+AAoA-Software, subject to the following conditions:+AAoACgAA-1) Neither the Font Software nor any of its individual components,+AAoA-in Original or Modified Versions, may be sold by itself.+AAoACgAA-2) Original or Modified Versions of the Font Software may be bundled,+AAoA-redistributed and/or sold with any software, provided that each copy+AAoA-contains the above copyright notice and this license. These can be+AAoA-included either as stand-alone text files, human-readable headers or+AAoA-in the appropriate machine-readable metadata fields within text or+AAoA-binary files as long as those fields can be easily viewed by the user.+AAoACgAA-3) No Modified Version of the Font Software may use the Reserved Font+AAoA-Name(s) unless explicit written permission is granted by the corresponding+AAoA-Copyright Holder. This restriction only applies to the primary font name as+AAoA-presented to the users.+AAoACgAA-4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+AAoA-Software shall not be used to promote, endorse or advertise any+AAoA-Modified Version, except to acknowledge the contribution(s) of the+AAoA-Copyright Holder(s) and the Author(s) or with their explicit written+AAoA-permission.+AAoACgAA-5) The Font Software, modified or unmodified, in part or in whole,+AAoA-must be distributed entirely under this license, and must not be+AAoA-distributed under any other license. The requirement for fonts to+AAoA-remain under this license does not apply to any document created+AAoA-using the Font Software.+AAoACgAA-TERMINATION+AAoA-This license becomes null and void if any of the above conditions are+AAoA-not met.+AAoACgAA-DISCLAIMER+AAoA-THE FONT SOFTWARE IS PROVIDED +ACIA-AS IS+ACIA, WITHOUT WARRANTY OF ANY KIND,+AAoA-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+AAoA-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+AAoA-OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+AAoA-COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+AAoA-INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+AAoA-DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+AAoA-FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+AAoA-OTHER DEALINGS IN THE FONT SOFTWARE." "http://scripts.sil.org/OFL" "" "Meera" "Regular" "Meera"
GaspTable: 3 8 2 16 1 65535 3 0
GaspTable: 1 65535 15 1
Encoding: UnicodeBmp
Compacted: 1
UnicodeInterp: none
......@@ -62,15 +62,44 @@ def validateGlyphs(font):
if refs:
glyph.references = refs
glyph.round()
# Hack, OTS rejects ligature carets!
glyph.lcarets = ()
def fixGasp(font, value=15):
try:
table = font.get('gasp')
table.gaspRange[65535] = value
except:
print('ER: {}: no table gasp')
def fixXAvgCharWidth(font):
"""xAvgCharWidth should be the average of all glyph widths in the font"""
width_sum = 0
count = 0
for glyph_id in font['glyf'].glyphs:
width = font['hmtx'].metrics[glyph_id][0]
if width > 0:
count += 1
width_sum += width
if count == 0:
fb.error("CRITICAL: Found no glyph width data!")
else:
expected_value = int(round(width_sum) / count)
font['OS/2'].xAvgCharWidth = int(round(width_sum) / count)
def opentype(infont, type, feature, version):
font = fontforge.open(infont)
if args.type == 'otf':
outfont = infont.replace(".sfd", ".otf")
flags = ("opentype", "round", "omit-instructions")
flags = ("opentype", "round", "omit-instructions", "dummy-dsig")
else:
outfont = infont.replace(".sfd", ".ttf")
flags = ("opentype", "round", "omit-instructions")
flags = ("opentype", "round", "omit-instructions", "dummy-dsig")
print("Generating %s => %s" % (infont, outfont))
tmpfont = mkstemp(suffix=os.path.basename(outfont))[1]
......@@ -86,7 +115,7 @@ def opentype(infont, type, feature, version):
font.mergeFeature(feature)
font.version = version
font.appendSFNTName('English (US)', 'Version',
version + '.0+' + time.strftime('%Y%m%d'))
'Version ' + version + '.0+' + time.strftime('%Y%m%d'))
font.selection.all()
font.correctReferences()
font.simplify()
......@@ -125,7 +154,12 @@ def opentype(infont, type, feature, version):
names.append(record)
name.names = names
font['OS/2'].version = 4
# https://www.microsoft.com/typography/otspec/os2.htm#fst
font['OS/2'].fsType = 0
if args.type == 'ttf':
fixGasp(font)
fixXAvgCharWidth(font)
# FFTM is FontForge specific, remove it
del(font['FFTM'])
# force compiling GPOS/GSUB tables by fontTools, saves few tens of KBs
......@@ -136,6 +170,7 @@ def opentype(infont, type, feature, version):
font.close()
os.remove(tmpfont)
def webfonts(infont, type):
font = TTFont(infont, recalcBBoxes=0)
# Generate WOFF2
......@@ -143,7 +178,6 @@ def webfonts(infont, type):
print("Processing %s => %s" % (infont, woffFileName))
font.flavor = type
font.save(woffFileName, reorderTables=False)
font.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment