Check-in [4ce1da6f02]
Not logged in

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

Overview
Comment:Clean up some contours, restore the X in the .notdef glyph's box (which still should be redrawn without overlaps), and clean up some comments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:4ce1da6f02d29cb63d12da5930efa5c76ace73d3
User & Date: Ross 2015-12-23 18:33:05
Context
2015-12-23
18:35
Make the MIT license I assumed I had applied explicit in the Readme and in the code. The license will also be added to the public repository's documentation, and the repository publicly announced some time after this checkin. check-in: dcc428b741 user: Ross tags: trunk
18:33
Clean up some contours, restore the X in the .notdef glyph's box (which still should be redrawn without overlaps), and clean up some comments. check-in: 4ce1da6f02 user: Ross tags: trunk
02:39
Found cause of installation problem on Windows due to missing a string from the TTF name table. Along the way, improved the calculation of a number of head and hhea fields, and made a variety of other tweaks. The output is now a valid (if badly named) TTF file that covers 0-9, A-F and a few punctuation marks drawn with inter-digit dots. check-in: 3a564d3a11 user: Ross tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/dotfonter.lua.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
These are ready to be added to a glyph if called out in the rom.
The style here is very angular, and does not include any gaps
between segments that would have to appear in practical display
construction.
]]
local segments = {
    a=X{[0]='contour',
        {[0]='pt', x=2,   y=896, on=1},
        {[0]='pt', x=638, y=896, on=1},
        {[0]='pt', x=510, y=768, on=1},
        {[0]='pt', x=130, y=768, on=1},
    },
    b=X{[0]='contour',
        {[0]='pt', x=640, y=894, on=1},
        {[0]='pt', x=640, y=450, on=1},
        {[0]='pt', x=512, y=514, on=1},
        {[0]='pt', x=512, y=766, on=1},
    },
    c=X{[0]='contour',
        {[0]='pt', x=640, y=446, on=1},
        {[0]='pt', x=640, y=2,   on=1},
        {[0]='pt', x=512, y=130, on=1},
        {[0]='pt', x=512, y=382, on=1},
    },
    d=X{[0]='contour',
        {[0]='pt', x=638, y=0, on=1},
        {[0]='pt', x=1,   y=0, on=1},
        {[0]='pt', x=130, y=128, on=1},
        {[0]='pt', x=511, y=128, on=1},
    },
    e=X{[0]='contour',
        {[0]='pt', x=0,   y=2,   on=1},
        {[0]='pt', x=0,   y=446, on=1},
        {[0]='pt', x=128, y=382, on=1},
        {[0]='pt', x=128, y=130, on=1},
    },
    f=X{[0]='contour',
        {[0]='pt', x=0,   y=450, on=1},
        {[0]='pt', x=0,   y=894, on=1},
        {[0]='pt', x=128, y=766, on=1},
        {[0]='pt', x=128, y=514, on=1},
    },
    g=X{[0]='contour',
        {[0]='pt', x=1,   y=448, on=1},
        {[0]='pt', x=129, y=512, on=1},
        {[0]='pt', x=511, y=512, on=1},
        {[0]='pt', x=639, y=448, on=1},
        {[0]='pt', x=511, y=384, on=1},
        {[0]='pt', x=129, y=384, on=1},
    },
    h=X{[0]='contour',
        {[0]='pt', x=704, y=0, on=1},
        {[0]='pt', x=704, y=126, on=1},
        {[0]='pt', x=830, y=126, on=1},
        {[0]='pt', x=830, y=0, on=1},
    },
    i=X{[0]='contour',
        {[0]='pt', x=704, y=-4, on=1},
        {[0]='pt', x=830, y=-4, on=1},
        {[0]='pt', x=704, y=-128, on=1},
    },
    j=X{[0]='contour',
        {[0]='pt', x=704, y=512, on=1},
        {[0]='pt', x=704, y=638, on=1},
        {[0]='pt', x=830, y=638, on=1},
        {[0]='pt', x=830, y=512, on=1},
................................................................................
    local g = X{[0]="TTGlyph", name=name,}
    for seg in ('abcdefghij'):gmatch'.' do
        if bars:find(seg) then
            g[#g+1] = segments[seg]
        end
    end
    g[#g+1] = X{[0]='instructions',X{[0]='assembly'}}
    -- when placing the glyph, we also must include the metrics.
    -- For seven segments, the only character with non-zero lsb
    -- will be the digit '1' so we check for that and adjust.
    ttfont.PlaceGlyph(g, {width=1024, lsb=lsb, a = 896, d=-128})
    ttfont.MapGlyph("unicode", char:byte(), name)
    if char:byte() <= 0x7f then
        ttfont.MapGlyph("mac", char:byte(), name)
    end
    ttfont.MapGlyph("win", char:byte(), name)
end
................................................................................
--[[ Adjust the strings.
--]]
ttfont.SetNames{
    vers='Version 001.042',
    copy='Copyright Ross Berteig 2015.',
    ffam='Upright Seven Segments',
    PSnm='UprightSevenSegments-Regular',
    ufid='Upright Segments 1.042 '.. os.date"%Y%m%d-%H%M%S" ,
    demo='ABCDEF 0123456789',
}

-- get the finished font and write it as TTX
local font = ttfont.GetFont()
--print(font)
font:save("temp.ttx")







|
|
|
|


|
|
|
|


|
|
|
|


|
|
|
|


|
|
|
|


|
|
|
|


|
|
|
|
|
|


|
|
|
|


|
|







 







<
<
<







 







|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
...
134
135
136
137
138
139
140



141
142
143
144
145
146
147
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
These are ready to be added to a glyph if called out in the rom.
The style here is very angular, and does not include any gaps
between segments that would have to appear in practical display
construction.
]]
local segments = {
    a=X{[0]='contour',
        {[0]='pt', x=10,  y=896, on=1},
        {[0]='pt', x=630, y=896, on=1},
        {[0]='pt', x=502, y=768, on=1},
        {[0]='pt', x=138, y=768, on=1},
    },
    b=X{[0]='contour',
        {[0]='pt', x=640, y=886, on=1},
        {[0]='pt', x=640, y=458, on=1},
        {[0]='pt', x=512, y=522, on=1},
        {[0]='pt', x=512, y=758, on=1},
    },
    c=X{[0]='contour',
        {[0]='pt', x=640, y=438, on=1},
        {[0]='pt', x=640, y=10,  on=1},
        {[0]='pt', x=512, y=138, on=1},
        {[0]='pt', x=512, y=374, on=1},
    },
    d=X{[0]='contour',
        {[0]='pt', x=630, y=0, on=1},
        {[0]='pt', x=10,  y=0, on=1},
        {[0]='pt', x=138, y=128, on=1},
        {[0]='pt', x=502, y=128, on=1},
    },
    e=X{[0]='contour',
        {[0]='pt', x=0,   y=10,  on=1},
        {[0]='pt', x=0,   y=438, on=1},
        {[0]='pt', x=128, y=374, on=1},
        {[0]='pt', x=128, y=138, on=1},
    },
    f=X{[0]='contour',
        {[0]='pt', x=0,   y=458, on=1},
        {[0]='pt', x=0,   y=886, on=1},
        {[0]='pt', x=128, y=758, on=1},
        {[0]='pt', x=128, y=522, on=1},
    },
    g=X{[0]='contour',
        {[0]='pt', x=10,  y=448, on=1},
        {[0]='pt', x=138, y=512, on=1},
        {[0]='pt', x=502, y=512, on=1},
        {[0]='pt', x=630, y=448, on=1},
        {[0]='pt', x=502, y=384, on=1},
        {[0]='pt', x=138, y=384, on=1},
    },
    h=X{[0]='contour',
        {[0]='pt', x=704, y=10, on=1},
        {[0]='pt', x=704, y=138, on=1},
        {[0]='pt', x=830, y=138, on=1},
        {[0]='pt', x=830, y=10, on=1},
    },
    i=X{[0]='contour',
        {[0]='pt', x=704, y=0, on=1},
        {[0]='pt', x=830, y=0, on=1},
        {[0]='pt', x=704, y=-128, on=1},
    },
    j=X{[0]='contour',
        {[0]='pt', x=704, y=512, on=1},
        {[0]='pt', x=704, y=638, on=1},
        {[0]='pt', x=830, y=638, on=1},
        {[0]='pt', x=830, y=512, on=1},
................................................................................
    local g = X{[0]="TTGlyph", name=name,}
    for seg in ('abcdefghij'):gmatch'.' do
        if bars:find(seg) then
            g[#g+1] = segments[seg]
        end
    end
    g[#g+1] = X{[0]='instructions',X{[0]='assembly'}}



    ttfont.PlaceGlyph(g, {width=1024, lsb=lsb, a = 896, d=-128})
    ttfont.MapGlyph("unicode", char:byte(), name)
    if char:byte() <= 0x7f then
        ttfont.MapGlyph("mac", char:byte(), name)
    end
    ttfont.MapGlyph("win", char:byte(), name)
end
................................................................................
--[[ Adjust the strings.
--]]
ttfont.SetNames{
    vers='Version 001.042',
    copy='Copyright Ross Berteig 2015.',
    ffam='Upright Seven Segments',
    PSnm='UprightSevenSegments-Regular',
    ufid='Upright Seven Segments '.. os.date"%Y-%m-%d" ,
    demo='ABCDEF 0123456789',
}

-- get the finished font and write it as TTX
local font = ttfont.GetFont()
--print(font)
font:save("temp.ttx")

Changes to src/ttfont.lua.

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
    },
    {[0]='contour',
        {[0]='pt', x=192, y= 64, on=1},
        {[0]='pt', x=832, y= 64, on=1},
        {[0]='pt', x=832, y=704, on=1},
        {[0]='pt', x=192, y=704, on=1},
    },
    --[[
    {[0]='contour',
        {[0]='pt', x=128, y= 45, on=1},
        {[0]='pt', x=851, y=768, on=1},
        {[0]='pt', x=896, y=723, on=1},
        {[0]='pt', x=183, y=  0, on=1},
    },
    {[0]='contour',
        {[0]='pt', x=128, y=723, on=1},
        {[0]='pt', x=183, y=768, on=1},
        {[0]='pt', x=896, y= 45, on=1},
        {[0]='pt', x=851, y=  0, on=1},
    }, 
    --]]
    {[0]='instructions',{[0]='assembly'}},
}
-- an empty glyph.
local nullglyph = xml.new{[0]="TTGlyph", name=".null" }
local crglyph = xml.new{[0]="TTGlyph", name="nonmarkingreturn" }
local spaceglyph = xml.new{[0]="TTGlyph", name="space" }








<












<







94
95
96
97
98
99
100

101
102
103
104
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
    },
    {[0]='contour',
        {[0]='pt', x=192, y= 64, on=1},
        {[0]='pt', x=832, y= 64, on=1},
        {[0]='pt', x=832, y=704, on=1},
        {[0]='pt', x=192, y=704, on=1},
    },

    {[0]='contour',
        {[0]='pt', x=128, y= 45, on=1},
        {[0]='pt', x=851, y=768, on=1},
        {[0]='pt', x=896, y=723, on=1},
        {[0]='pt', x=183, y=  0, on=1},
    },
    {[0]='contour',
        {[0]='pt', x=128, y=723, on=1},
        {[0]='pt', x=183, y=768, on=1},
        {[0]='pt', x=896, y= 45, on=1},
        {[0]='pt', x=851, y=  0, on=1},
    }, 

    {[0]='instructions',{[0]='assembly'}},
}
-- an empty glyph.
local nullglyph = xml.new{[0]="TTGlyph", name=".null" }
local crglyph = xml.new{[0]="TTGlyph", name="nonmarkingreturn" }
local spaceglyph = xml.new{[0]="TTGlyph", name="space" }