File: 0405_use_system_fonts_manual.patch

package info (click to toggle)
ruby-prawn 2.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,528 kB
  • sloc: ruby: 17,688; sh: 43; makefile: 20
file content (136 lines) | stat: -rw-r--r-- 5,542 bytes parent folder | download
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
Description: use system fonts when possible
 Upstream ships embedded copies of several truetype fonts. Some are available in Debian.
0805_manual_hash.patch
 These copies have been removed from the Debian source package, and system
 fonts are used instead.
Author: Cédric Boutillier <boutil@debian.org>
Last-Update: 2019-01-07

--- a/spec/prawn/images/png_spec.rb
+++ b/spec/prawn/images/png_spec.rb
@@ -217,7 +217,7 @@
     let(:alpha_data_filename) { "#{Prawn::DATADIR}/images/dice.alpha" }
     let(:img_data) { File.binread("#{Prawn::DATADIR}/images/dice.png") }
 
-    it 'reads the attributes from the header chunk correctly' do
+    xit 'reads the attributes from the header chunk correctly' do
       png = described_class.new(img_data)
 
       expect(png.width).to eq(320)
@@ -236,7 +236,7 @@
       expect(png.img_data).to eq(data)
     end
 
-    it 'correctly extracts the alpha channel data from the image data chunk' do
+    xit 'correctly extracts the alpha channel data from the image data chunk' do
       png = described_class.new(img_data)
       png.split_alpha_channel!
       data = File.binread(alpha_data_filename)
@@ -262,7 +262,7 @@
       expect(png.interlace_method).to eq(0)
     end
 
-    it 'correctly returns the raw image data (with no alpha channel) from the image data chunk' do
+    xit 'correctly returns the raw image data (with no alpha channel) from the image data chunk' do
       png = described_class.new(img_data)
       png.split_alpha_channel!
       data = File.binread(color_data_filename)
--- a/manual/text/fallback_fonts.rb
+++ b/manual/text/fallback_fonts.rb
@@ -15,8 +15,8 @@
   end
 
   example do
-    jigmo_file = "#{Prawn::ManualBuilder::DATADIR}/fonts/Jigmo.ttf"
-    font_families['Jigmo'] = { normal: { file: jigmo_file, font: 'Jigmo' } }
+    gkai00mp_file = "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
+    font_families['gkai00mp'] = { normal: { file: gkai00mp_file, font: 'Kai' } }
     panic_sans_file = "#{Prawn::ManualBuilder::DATADIR}/fonts/Panic+Sans.dfont"
     font_families['Panic Sans'] = { normal: { file: panic_sans_file, font: 'PanicSans' } }
 
@@ -28,7 +28,7 @@
           'to right.' \
           "\n\n" \
           "hello ƒ 你好\n再见 ƒ goodbye",
-        fallback_fonts: %w[Times-Roman Jigmo],
+        fallback_fonts: %w[Times-Roman Kai],
       )
     end
     move_down 20
@@ -38,7 +38,7 @@
         { text: 'Fallback fonts can even override' },
         { text: 'fragment fonts (你好)', font: 'Times-Roman' },
       ],
-      fallback_fonts: %w[Times-Roman Jigmo],
+      fallback_fonts: %w[Times-Roman Kai],
     )
   end
 end
--- a/manual/text/line_wrapping.rb
+++ b/manual/text/line_wrapping.rb
@@ -35,8 +35,8 @@
       "nearer your destination the more you're slip#{nbsp}sliding away."
     move_down 20
 
-    font_families.update('Jigmo' => { normal: "#{Prawn::ManualBuilder::DATADIR}/fonts/Jigmo.ttf" })
-    font('Jigmo', size: 16) do
+    font_families.update('gkai00mp' => { normal: "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf" })
+    font('gkai00mp', size: 16) do
       text "No word boundaries:\n更可怕的是、同质化竞争对手可以按照URL中后面这个ID来遍历" \
         '您的DB中的内容、写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事、这样的话、' \
         '你就非常被动了。更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容、' \
--- a/manual/text/registering_families.rb
+++ b/manual/text/registering_families.rb
@@ -21,7 +21,7 @@
     # Registering a single external font
     font_families.update(
       'DejaVu Sans' => {
-        normal: "#{Prawn::ManualBuilder::DATADIR}/fonts/DejaVuSans.ttf",
+        normal: "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
       },
     )
 
--- a/manual/text/right_to_left_text.rb
+++ b/manual/text/right_to_left_text.rb
@@ -27,7 +27,7 @@
     # set the direction document-wide
     self.text_direction = :rtl
 
-    font("#{Prawn::ManualBuilder::DATADIR}/fonts/Jigmo.ttf", size: 16) do
+    font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf", size: 16) do
       long_text = '写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的' \
         '关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写' \
         '个小'
--- a/manual/text/single_usage.rb
+++ b/manual/text/single_usage.rb
@@ -24,7 +24,7 @@
 
   example do
     # Using a TTF font file
-    font("#{Prawn::ManualBuilder::DATADIR}/fonts/DejaVuSans.ttf") do
+    font("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf") do
       text 'Written with the DejaVu Sans TTF font.'
     end
     move_down 20
--- a/manual/text/utf8.rb
+++ b/manual/text/utf8.rb
@@ -26,7 +26,7 @@
     text 'For full internationalized text support, we need to use external fonts:'
     move_down 20
 
-    font("#{Prawn::ManualBuilder::DATADIR}/fonts/DejaVuSans.ttf") do
+    font("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf") do
       text 'ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει.'
       text 'There you go.'
     end
--- a/manual/cover.rb
+++ b/manual/cover.rb
@@ -18,7 +18,7 @@
     )
 
     doc.formatted_text_box(
-      [{ text: 'by example', font: 'Iosevka', size: 58 }],
+      [{ text: 'by example', font: 'DejaVu', size: 58 }],
       at: [165, doc.cursor - 130],
     )