Check-in [3eea976223]
Not logged in

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

Overview
Comment:Punched paper tape font, fed starting from left, with bit 0 at the top edge. Set at 72 point for approximately 100% scale of real paper tape.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3eea976223ad07799e019f10d7662d123cf90b8a
User & Date: Ross 2016-03-10 21:06:34
Context
2016-03-10
21:22
Pick up circle definition as improved for the punched paper tape font. Adjust Makefile to have sensible targets, and to build TTF files for each demo font by default. check-in: 5322fb3e47 user: Ross tags: trunk
21:06
Punched paper tape font, fed starting from left, with bit 0 at the top edge. Set at 72 point for approximately 100% scale of real paper tape. check-in: 3eea976223 user: Ross tags: trunk
01:02
Work in progress on a 5x7 dot matrix font with nearly circular dots. Covers codes 0x21 thru 0x47. Plan is to complete the 96 printable ASCII slots. Modeled after the character generator ROM in the popular HD44780 LCD controller chip. check-in: 5d5253b6c6 user: Ross tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added src/papertape.dotfont.















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
81
82
83
84
85
86
87
88
89
90
91
92
93
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
--[[ 
#Punched Paper Tape for dotfonter
--]]

--[[
#License
Copyright (C) 2016 Cheshire Engineering Corp.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--]]


--[[
##Puch hole contours

These are drawn on a design grid with 1024 units per em, and sized 
assuming 1 em == 1 inch. At that scale, the holes should line up with
real paper tape as used by an ASR-33 and similar paper tape equipment.

All holes are on 0.1 inch centers, with the first row of holes centered
0.1 inches from the edge. 1 inch tape width has room for 9 tracks of holes,
8 tracks are data bits and one track is for sprocket feed (or timing). The 
data holes are 0.072 inches diameter, timing holes are 0.046 inch.


We'll draw a hole as a nearly circular blob centered in an 0.1 inch (102 unit)
square.

]]
local function circle(r,cx,cy)
    local rc = math.ceil(r*0.91)
    return {
        {cx-r,  cy,    1},
        {cx-rc, cy+rc, 0},
        {cx,    cy+r,  1},
        {cx+rc, cy+rc, 0},
        {cx+r,  cy,    1},
        {cx+rc, cy-rc, 0},
        {cx,    cy-r,  1},
        {cx-rc, cy-rc, 0}
    }
end

local holes = {
    data = circle(37,51,51),
    timing = circle(23,51,51)
}
local function hole(n,h)
    local t={}
    local no = math.floor(819.2-n*102.4+0.5)
    for i=1,#h do
        t[i] = { h[i][1], h[i][2]+no, h[i][3] }
    end
    return t
end

-- Normalize a a glyph in the character ROM. 
-- Create an array of countours from its pat entry and provide defaults 
-- for metrics, name, and character codes.
local function Glyph(t)
    assert(type(t)=='table')
    local pat = assert(t.pat)
    
    -- default metrics
    t.width = t.width or 103
    t.lsb = t.lsb or 14
    t.a, t.d = t.a or 1024, t.d or 0
    
    -- default mapping
    assert(t.name)
    if not t.unicode then t.unicode = t.name:byte() end
    if not t.mac and t.unicode < 127 then t.mac = t.unicode end
    if not t.win then t.win = t.unicode end
    
    -- fill out array of contours
    local n = tonumber(pat)
    t[#t+1] = hole(3, holes.timing)
    for bit=0,7 do
        if n%2 == 1 then
            t[#t+1] = hole(bit > 2 and bit+1 or bit, holes.data)
        end
        n = math.floor(n / 2)
    end
    if t.unicode == 0xEE00 then
        t.lsb = 28
    end
    return t
end

--[[ 
##Punched Paper Tape

Glyphs are layed out so that the least bit is at the top, or the 
tape is read from left to right.

--]]

--[[
        Glyph{unicode=0x20, name='space', pat={
                '.....',
                '.....',
                '.....',
                '.....',
                '.....',
                '.....',
                '.....',
            }
        },
--]]
local Gs = {}
for i=0,255,1 do
    local c = Glyph{unicode=0xee00+i, name=("U+EE%02X"):format(i), pat=i}
    Gs[#Gs+1] = c
end

return {
    Glyphs = Gs,

    --[[ 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.

    --]]
    Names = {
        copy='Copyright Ross Berteig 2016.',
        ffam='Punched Paper Tape LtR',
        PSnm='PunchedPaperTapeLtR-Regular',
        ufid='Punched Paper Tape LtR '.. os.date"%Y-%m-%d" ,
        vers='Version 001.000',
        demo='0123456789',
    }
}