Check-in [76c607c341]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed a bug in the calculation of the font bounding box with matching change to the seven segment font definition. This showed in Windows by the font being clipped at the baseline instead of allowing the descenders in the comman and colon to show.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 76c607c34152662e45c153178985159065fb597c
User & Date: Ross 2015-12-31 01:05:03.352
Context
2015-12-31
01:52
Add a demostration of how to make kerning pairs. check-in: fd4cf2422a user: Ross tags: trunk
01:05
Fixed a bug in the calculation of the font bounding box with matching change to the seven segment font definition. This showed in Windows by the font being clipped at the baseline instead of allowing the descenders in the comman and colon to show. check-in: 76c607c341 user: Ross tags: trunk
2015-12-30
01:19
Add a basic command line parser based on the Penlight library pl.lapp module, and use it to check arguments, produce a usage message, and implement a proper --verbose option. check-in: 9a99a4c5e4 user: Ross tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/sevensegment.dotfont.
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
        Glyph{unicode=0x41, pat='abc efg', name='A'},
        Glyph{unicode=0x42, pat='  cdefg', name='B'},
        Glyph{unicode=0x43, pat='a  def ', name='C'},
        Glyph{unicode=0x44, pat=' bcde g', name='D'},
        Glyph{unicode=0x45, pat='a  defg', name='E'},
        Glyph{unicode=0x46, pat='a   efg', name='F'},
        Glyph{unicode=0x2E, pat='h', name='period', lsb=704},
        Glyph{unicode=0x2C, pat='hi', name='comma', lsb=704},
        Glyph{unicode=0x3A, pat='hj', name='colon', lsb=704},
        Glyph{unicode=0x3B, pat='hij', name='semicolon', lsb=704},
        Glyph{unicode=0x23, pat='abcdefghij', name='numbersign', lsb=0},
    },

    --[[ Set the strings. 

    Note that ffam, fsub, ufid, name, vers, and PSnm are required by Windows.
    Of those, fsub defaults to 'Regular' and name gets a sensible defaults based
    on ffam and fsub.







|

|
|







182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
        Glyph{unicode=0x41, pat='abc efg', name='A'},
        Glyph{unicode=0x42, pat='  cdefg', name='B'},
        Glyph{unicode=0x43, pat='a  def ', name='C'},
        Glyph{unicode=0x44, pat=' bcde g', name='D'},
        Glyph{unicode=0x45, pat='a  defg', name='E'},
        Glyph{unicode=0x46, pat='a   efg', name='F'},
        Glyph{unicode=0x2E, pat='h', name='period', lsb=704},
        Glyph{unicode=0x2C, pat='hi', name='comma', lsb=704, d=-128},
        Glyph{unicode=0x3A, pat='hj', name='colon', lsb=704},
        Glyph{unicode=0x3B, pat='hij', name='semicolon', lsb=704, d=-128},
        Glyph{unicode=0x23, pat='abcdefghij', name='numbersign', lsb=0, d=-128},
    },

    --[[ Set the strings. 

    Note that ffam, fsub, ufid, name, vers, and PSnm are required by Windows.
    Of those, fsub defaults to 'Regular' and name gets a sensible defaults based
    on ffam and fsub.
Changes to src/ttfont.lua.
51
52
53
54
55
56
57

58
59
60
61
62
63
64

require "luaXml"
if not xml then xml = require "luaXml" end
local X = xml.new
local M={ _NAME=(...) }
package.loaded[M._NAME] = M
local ttx = require 'ttxml'


--local ttfcmap = require 'ttfcmap'
local ttfhead = require 'ttfhead'
local ttfhhea = require 'ttfhhea'
--local ttfhmtx = require 'ttfhmtx'
--local ttfloca = require 'ttfloca' -- created entirely by the TTX compiler
local ttfmaxp = require 'ttfmaxp'







>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

require "luaXml"
if not xml then xml = require "luaXml" end
local X = xml.new
local M={ _NAME=(...) }
package.loaded[M._NAME] = M
local ttx = require 'ttxml'
local min,max = math.min, math.max

--local ttfcmap = require 'ttfcmap'
local ttfhead = require 'ttfhead'
local ttfhhea = require 'ttfhhea'
--local ttfhmtx = require 'ttfhmtx'
--local ttfloca = require 'ttfloca' -- created entirely by the TTX compiler
local ttfmaxp = require 'ttfmaxp'
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
        end
        glyph:append(xml.new{[0]='instructions',X{[0]='assembly'}})
    end
    
    tables.GlyphOrder:append{[0]="GlyphID", id=tables.nextid, name=glyph.name}
    tables.nextid = tables.nextid + 1
    tables.glyf:append(glyph)
    
    M.minX = M.minX < (t.lsb or 0) and M.minX or t.lsb
    M.maxX = M.maxX > (t.width or 0) and M.maxX or t.width
    M.minY = M.minY < (t.d or 0) and M.minY or t.d
    M.maxY = M.maxY > (t.a or 0) and M.maxY or t.a
    
    tables.hmtx:append{[0]='mtx', name=glyph.name, width=t.width, lsb=t.lsb}
end

-- standards recommmend that .notdef look like an empty box, a box 
-- with an X in it, or a box with a '?' in it. Because the diagonal 
-- lines will stand out from the dots making up all other glyphs more







|
<
|
|
|







113
114
115
116
117
118
119
120

121
122
123
124
125
126
127
128
129
130
        end
        glyph:append(xml.new{[0]='instructions',X{[0]='assembly'}})
    end
    
    tables.GlyphOrder:append{[0]="GlyphID", id=tables.nextid, name=glyph.name}
    tables.nextid = tables.nextid + 1
    tables.glyf:append(glyph)
    M.minX = min(M.minX, t.lsb or 0)

    M.maxX = max(M.maxX, t.width or 0)
    M.minY = min(M.minY, t.d or 0)
    M.maxY = max(M.maxY, t.a or 0)
    
    tables.hmtx:append{[0]='mtx', name=glyph.name, width=t.width, lsb=t.lsb}
end

-- standards recommmend that .notdef look like an empty box, a box 
-- with an X in it, or a box with a '?' in it. Because the diagonal 
-- lines will stand out from the dots making up all other glyphs more
264
265
266
267
268
269
270





271
272
273
274
275
276
277
function M.SetNames(t)
    local names
    tables.name, names = ttfname.BuildNameTable(t)
    return names
end

function M.GetFont()





    
    ttfhhea.ascent = M.maxY
    ttfos_2.sTypoAscender = M.maxY
    ttfos_2.usWinAscent = M.maxY
    
    ttfhhea.descent = M.minY
    ttfos_2.sTypoDescender = M.minY







>
>
>
>
>







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
function M.SetNames(t)
    local names
    tables.name, names = ttfname.BuildNameTable(t)
    return names
end

function M.GetFont()
    
    ttfhead.xMin = M.minX
    ttfhead.yMin = M.minY
    ttfhead.xMax = M.maxX
    ttfhead.yMax = M.maxY
    
    ttfhhea.ascent = M.maxY
    ttfos_2.sTypoAscender = M.maxY
    ttfos_2.usWinAscent = M.maxY
    
    ttfhhea.descent = M.minY
    ttfos_2.sTypoDescender = M.minY