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
|
map entry:
cyberb@Unicode@ <cyberbit.ttf PidEid=3,1
means
cyberb<INFIX> => look at Unicode.sfd => find the mapping => charcode
=> PidEid=3,1 => glyphs
eg cyberb01 => subfont 01 in Unicode.sfd => charcodes
Infix can be anything, thus the question: given a tfm name, how to find out
whether this is a subfont?
It is safe to limit the infix to be composed from hexadecimal digits only?
If so, one possibility is:
(1)
while last-char-of-tfmname is a hexdigit do
remove the last char from tfmname
do a lookup for the tfmname
if found an entry with subfont flag then
break
enddo
(2)
Or, when a map entry with subfont flag is scanned, let pdftex create all
the relevant entries. Which may be a safer and faster solution (but wastes more
memory)
Let's do (2), as infix can be any word.
Implementation:
- let's have a map entry:
cyberb@Unicode@ <cyberbit.ttf PidEid=3,1
- actions:
- read Unicode.sfd
- create corresponding sfd mapping like ("01", "Unicode") => long[256]
- added those subfont to an AVL tree
- create map entries for cyberb01--cyberbff, each has a pointer to the
corresponding sfd mapping entry
- extended attributes for map entry:
- Pid
- Eid
- sfd_map
- sfd_mapping:
- name: sfd name, eg "Unicode"
- infix, eg "01"
- mapping: long[256]
- how to find out whether a sfd has been loaded:
- lookup for any entry with the given sfd name
- functions:
- load_sfd
- lookup_subfont
- extend reading map entries
- when writting ttf:
- if re-encoded --> process like in case of type1 fonts
- if PidEid is being used:
- read cmap tables: store (ttfname, pid, eid)
- search for used chars
- use sfd to find the charcodes
- look into cmap to
|