summaryrefslogtreecommitdiff
blob: 4c976b467380b8dacc1c53a9233718c9c9f48753 (plain)
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
diff -ruN ghostscript-7.07.orig/lib/gs_ttf.ps ghostscript-7.07/lib/gs_ttf.ps
--- ghostscript-7.07.orig/lib/gs_ttf.ps	2003-08-04 15:23:15.000000000 +0900
+++ ghostscript-7.07/lib/gs_ttf.ps	2003-08-04 15:22:23.000000000 +0900
@@ -1104,9 +1104,26 @@
 % 4	2	Offset	Coverage(--)
 % 6	2	uint16	GlyphCount
 % 8	2	GlyphID	Substitute(vertically oriented glyphs)
-% --	2	uint16	SubstFormat
-% +2	2	uint16	GlyphCount(same as above GlyphCount)
-% +4	2	GlyphID	GlyphArray(horizontally oriented glyphs)
+%
+% [Coverage Format 1, Individual glyph indices]
+% Index Size    Type    Name of Entry
+% -----------------------------------
+% 0     2       uint16  CoverageFormat (Format identifier-format = 1)
+% 2     2       uint16  GlyphCount (same as above GlyphCount)
+% 4     2       GlyphID GlyphArray (horizontally oriented glyphs)
+%
+% [Coverage Format 2, Range of glyphs
+% Index Size    Type    Name of Entry
+% -----------------------------------
+% 0     2       uint16  CoverageFormat (Format identifier-format = 2)
+% 2     2       uint16  RangeCount
+% 4     2       struct  RangeRecord[RangeCount]
+% [RangeRecord]
+% Index Size    Type    Name of Entry
+% -----------------------------------
+% 0     2       GlyphID First GlyphID in the range
+% 2     2       GlyphID Last GlyphID in the range
+% 4     2       uint16  Coverage Index of first GlpyhID in range
 % -----------------------------------
 % References
 % 1. http://www.microsoft.com/typography/OTSPEC/gsub.htm
@@ -1161,10 +1178,13 @@
 	      %dup /gsubvog exch gsubost 6 add gsubglc getinterval def
 	      %dup /gsubhog exch gsubost gsubocv add 4 add gsubglc getinterval def
 	      dup /gsubvog exch gsubost 6 add gsubglc 2 mul getinterval def
-	      dup /gsubhog exch gsubost gsubocv add 4 add gsubglc 2 mul getinterval def
+	      dup /cvfmt exch gsubost gsubocv add 0 add getu16 def
+	      dup /cvglc exch gsubost gsubocv add 2 add getu16 def
+	      dup /gsubhog exch gsubost gsubocv add 4 add cvglc 2 mul getinterval def
 	      DEBUG {
 		(gsubocv: ) print gsubocv =
 		(gsubglc: ) print gsubglc =
+		(cvfmt: ) print cvfmt =
 
 		(gsubhog->gsubvog ) =
 		0 2 gsubhog length 2 sub { % for
@@ -1174,10 +1194,31 @@
 		  gsubvog exch getu16 =
 		} for
 	      } if
-	      /gsubh2v << 0 2 gsubhog length 2 sub {
-		dup gsubhog exch getu16
-		exch gsubvog exch getu16
-	      } for >> def
+	      cvfmt 1 eq {
+		/gsubh2v << 0 2 gsubhog length 2 sub {
+		  dup gsubhog exch getu16
+		  exch gsubvog exch getu16
+		} for >> def
+	      } {
+		cvfmt 2 eq {
+		  /gsubh2v << 0 6 gsubhog length 6 sub {
+		    dup 0 add /fgid exch gsubhog exch getu16 def
+		    dup 2 add /lgid exch gsubhog exch getu16 def
+		    4 add /cvidx exch gsubhog exch getu16 def
+		    DEBUG {
+		      (fgid: ) print fgid =
+		      (lgid: ) print lgid =
+		      (cvidx: ) print cvidx =
+		    } if
+		    fgid 1 lgid {
+		      dup cvidx add fgid sub
+		      exch gsubvog exch getu16
+		    } for
+		  } for >> def
+		} {
+		  %(UNKNWON COVERAGE FORMAT.) = flush
+		} ifelse
+	      } ifelse
 	    } {
 	      %(UNKNOWN GSUB FORMAT.) = flush
 	    } ifelse