rsyntaxtree 0.8.8 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1d573e0201c4374f3fc497b12eb34856fcedeb3513b7d17e403c3d85dbb4d1c
4
- data.tar.gz: 60b26c37bd71b6f89f6a048a8e594945783d2486def18e4b9b170e89a68bf91c
3
+ metadata.gz: 69c3a36921d2441f35c9729197aaea3ded204780b7033361a3434605e17e70cb
4
+ data.tar.gz: 342c7b8e779e2fca098d441f11ea7a458e050e42b49957369a7af3ac9ffd5ce8
5
5
  SHA512:
6
- metadata.gz: f9bc21b39ead52c96d917d799354b84b1c99c1f9d0a7078611e2213086d31d16c3bbb416ce856c874a0563a018b2df8452da1bdaad056348c86905d7a914a40f
7
- data.tar.gz: e44c03daee5602becb706539f4035d8272d6096d1a26a7e79b0b0c0e439e579a24b85d04717bc1794704c19df24f47d0f95b6f2f05c66abe955f568ac52b189c
6
+ metadata.gz: ddffb304231af332a8de21e29a97943570b8297749c7368c536b0f15103a392c4f10f1b6c77c79c0ab8b48a3fbe05ccfcc09da69b20b53c0f5a41692245d5137
7
+ data.tar.gz: 0c6a91490bdf0a26bcfed5cdad68bc25fdd9252577b86a638a8a6ce72a4c5c297324dda81e9e0f1852bee545d437d16f625ec312141fd8a56868b691d9bd05b6
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -24,7 +24,7 @@ class Element
24
24
  @width = 0 # Width of the element in pixels
25
25
  @indent = 0 # Drawing offset
26
26
  content = content.strip
27
- if /\A.+\^\z/ =~ content
27
+ if /\A.+\^\z/m =~ content
28
28
  @content = content.gsub("^"){""} # The actual element content
29
29
  @triangle = true # draw triangle instead of stright bar when in auto mode
30
30
  else
@@ -23,7 +23,7 @@ class ErrorMessage
23
23
  @filename = filename
24
24
  @format = format
25
25
 
26
- metrics = img_get_txt_metrics(text, font, font_size, true)
26
+ metrics = img_get_txt_metrics(text, font, font_size, NoDecoration, true)
27
27
 
28
28
  @im = Image.new(metrics.width, metrics.height)
29
29
  @gc = Draw.new
@@ -66,6 +66,9 @@ class Graph
66
66
  gc.pointsize = font_size
67
67
  gc.gravity = CenterGravity
68
68
  gc.stroke = 'none'
69
+ gc.kerning = 0
70
+ gc.interline_spacing = 0
71
+ gc.interword_spacing = 0
69
72
  end
70
73
 
71
74
  if multiline
@@ -81,18 +84,19 @@ class Graph
81
84
  # for all child elements.
82
85
  def calc_element_width(e)
83
86
  w = 0
87
+ content = e.content.gsub("<>", " ")
84
88
 
85
89
  children = @e_list.get_children(e.id)
86
90
 
87
91
  if(children.length == 0)
88
- w = img_get_txt_width(e.content, @font, @font_size) + @font_size
92
+ w = img_get_txt_width(content, @font, @font_size) + @font_size
89
93
  else
90
94
  children.each do |child|
91
95
  child_e = @e_list.get_id(child)
92
96
  w += calc_element_width(child_e)
93
97
  end
94
98
 
95
- tw = img_get_txt_width(e.content, @font, @font_size) + @font_size
99
+ tw = img_get_txt_width(content, @font, @font_size) + @font_size
96
100
  if(tw > w)
97
101
  fix_child_size(e.id, w, tw)
98
102
  w = tw
@@ -186,13 +190,13 @@ class Graph
186
190
  end
187
191
  end
188
192
  return true if !@symmetrize
189
-
193
+
190
194
  elements_to_draw = {}
191
195
  triangles_to_draw = []
192
196
  lines_to_draw = []
193
197
 
194
198
  lmost = {:level => nil, :value => nil, :type => nil}
195
- rmost = nil
199
+ rmost = nil
196
200
  h.times do |i|
197
201
  curlevel = h - i - 1
198
202
  e_arr.each_with_index do |j, idx|
@@ -299,8 +303,9 @@ class Graph
299
303
  return text
300
304
  end
301
305
 
302
- def img_get_txt_height(text, font, font_size, multiline = false)
306
+ def img_get_txt_height(text, font, font_size, multiline = true)
303
307
  metrics = img_get_txt_metrics(text, font, font_size, multiline)
308
+ # y = (metrics.bounds.y2 - metrics.bounds.y1).round
304
309
  y = metrics.height
305
310
  return y
306
311
  end
@@ -171,8 +171,15 @@ class StringParser
171
171
  end
172
172
  when "\\"
173
173
  escape = true
174
- when /[\n\r]/
175
- gottoken = false # same as do nothing
174
+ when "n", " ", "+", "-", "=", "~", "#", "*"
175
+ if escape
176
+ token += "\\#{ch}"
177
+ escape = false
178
+ else
179
+ token += ch
180
+ end
181
+ # when /[\n\r]/
182
+ # gottoken = false # same as do nothing
176
183
  else
177
184
  token += ch
178
185
  escape = false if escape
@@ -27,17 +27,23 @@ class SVGGraph < Graph
27
27
 
28
28
  case fontstyle
29
29
  when /(?:sans|cjk)/
30
- @fontstyle = "sans-serif"
31
- when /(?:serif|math)/
32
- @fontstyle = "serif"
30
+ @fontstyle = "\"'Noto Sans JP', 'Noto Sans', sans-serif\""
31
+ @fontcss = "http://fonts.googleapis.com/earlyaccess/notosansjp.css"
32
+ when /(?:serif)/
33
+ @fontstyle = "\"'Noto Serif JP', 'Noto Serif', serif\""
34
+ @fontcss = "https://fonts.googleapis.com/css?family=Noto+Serif+JP"
35
+ when /(?:math)/
36
+ @fontstyle = "\"Latin Modern Roman', sans-serif\""
37
+ @fontcss = "https://cdn.jsdelivr.net/gh/sugina-dev/latin-modern-web@1.0.1/style/latinmodern-roman.css"
33
38
  end
39
+
34
40
  @margin = margin.to_i
35
41
 
36
- super(e_list, metrics, symmetrize, color, leafstyle, multibyte, @font, @font_size)
42
+ super(e_list, metrics, symmetrize, color, leafstyle, multibyte, @fontstyle, @font_size)
37
43
 
38
44
  @line_styles = "<line style='stroke:black; stroke-width:#{FONT_SCALING};' x1='X1' y1='Y1' x2='X2' y2='Y2' />\n"
39
45
  @polygon_styles = "<polygon style='fill: none; stroke: black; stroke-width:#{FONT_SCALING};' points='X1 Y1 X2 Y2 X3 Y3' />\n"
40
- @text_styles = "<text style='fill: COLOR; font-size: FONT_SIZEpx; ST; WA;' x='X_VALUE' y='Y_VALUE' TD font-family='#{@fontstyle}'>CONTENT</text>\n"
46
+ @text_styles = "<text letter-spacing='0' word-spacing='0' kerning='0' style='fill: COLOR; font-size: FONT_SIZE ST WA' x='X_VALUE' y='Y_VALUE' TD font-family=#{@fontstyle}>CONTENT</text>\n"
41
47
  @tree_data = String.new
42
48
  end
43
49
 
@@ -54,11 +60,17 @@ class SVGGraph < Graph
54
60
 
55
61
  header =<<EOD
56
62
  <?xml version="1.0" standalone="no"?>
57
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
63
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
58
64
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
59
65
  <svg width="#{width}" height="#{height}" viewBox="#{-@margin + lm}, -#{@margin}, #{@width - lm + @margin * 2}, #{@height + @margin * 2}" version="1.1" xmlns="http://www.w3.org/2000/svg">
66
+ <defs>
67
+ <style>
68
+ @import url(#{@fontcss});
69
+ </style>
70
+ </defs>
60
71
  EOD
61
72
 
73
+
62
74
  rect =<<EOD
63
75
  <rect x="#{-@margin + lm}" y="-#{@margin}" width="#{@width - lm + @margin * 2}" height="#{@height + @margin * 2}" stroke="none" fill="white" />"
64
76
  EOD
@@ -89,21 +101,21 @@ EOD
89
101
  end
90
102
 
91
103
  :private
92
-
104
+
93
105
  # Add the element into the tree (draw it)
94
106
  def draw_element(x, y, w, string, type)
95
- string = string.sub(/\^\z/){""}
107
+ string = string.sub(/\^\z/){""}
96
108
  # Calculate element dimensions and position
97
109
  if (type == ETYPE_LEAF) and @leafstyle == "nothing"
98
110
  top = row2px(y - 1) + (@font_size * 1.5)
99
- else
111
+ else
100
112
  top = row2px(y)
101
113
  end
102
114
  left = x + @m[:b_side]
103
115
  bottom = top + @e_height
104
116
  right = left + w
105
117
 
106
- # Split the string into the main part and the
118
+ # Split the string into the main part and the
107
119
  # subscript part of the element (if any)
108
120
  parts = string.split("_", 2)
109
121
  if(parts.length > 1 )
@@ -148,11 +160,18 @@ EOD
148
160
  main = $1
149
161
  end
150
162
 
151
- # Calculate text size for the main and the
163
+ # Calculate text size for the main and the
152
164
  # subscript part of the element
153
165
  # symbols for underline/overline removed temporarily
154
166
 
155
- main_width = img_get_txt_width(main, @font, @font_size)
167
+ main_width = 0
168
+ main_height = 0
169
+ main.split(/\\n/).each do |l|
170
+ l_width = img_get_txt_width(l, @font, @font_size)
171
+ main_width = l_width if main_width < l_width
172
+ main_height += img_get_txt_height(l, @font, @font_size)
173
+ end
174
+
156
175
 
157
176
  if sub != ""
158
177
  if /\A\=(.+)\=\z/ =~ sub
@@ -184,9 +203,11 @@ EOD
184
203
  sub_style = ""
185
204
  sub_weight = ""
186
205
  end
206
+ sub_height = img_get_txt_height(sub, @font, @font_size)
187
207
  sub_width = img_get_txt_width(sub.to_s, @font, @sub_size)
188
208
  else
189
209
  sub_width = 0
210
+ sub_height = 0
190
211
  end
191
212
 
192
213
  if /\A#(.+)#\z/ =~ sub
@@ -194,14 +215,13 @@ EOD
194
215
  end
195
216
 
196
217
  # Center text in the element
197
- txt_width = main_width + sub_width
198
- txt_pos = left + (right - left) / 2 - txt_width / 2
218
+ txt_pos = left + (right - left) / 2
199
219
 
200
220
  # Select apropriate color
201
221
  if(type == ETYPE_LEAF)
202
222
  col = @col_leaf
203
223
  else
204
- col = @col_node
224
+ col = @col_node
205
225
  end
206
226
 
207
227
  if(main[0].chr == "<" && main[-1].chr == ">")
@@ -210,29 +230,47 @@ EOD
210
230
 
211
231
  # Draw main text
212
232
  main_data = @text_styles.sub(/COLOR/, col)
213
- main_data = main_data.sub(/FONT_SIZE/, @font_size.to_s)
214
- main_x = txt_pos
215
- main_y = top + @e_height - @m[:e_padd] * 1.5
233
+ main_data = main_data.sub(/FONT_SIZE/, @font_size.to_s + "px;")
234
+ main_x = txt_pos - (main_width + sub_width) / 2
235
+ main_y = top + @e_height - @m[:e_padd]
216
236
  main_data = main_data.sub(/X_VALUE/, main_x.to_s)
217
237
  main_data = main_data.sub(/Y_VALUE/, main_y.to_s)
218
-
238
+ if /\\n/ =~ main
239
+ lines = main.split(/\\n/)
240
+ new_main = ""
241
+ dy = 0
242
+ lines.each_with_index do |l, idx|
243
+ if idx == 0
244
+ dy = 0
245
+ else
246
+ dy = 1
247
+ main_y += img_get_txt_height(l, @font, @font_size)
248
+ end
249
+ this_width = img_get_txt_width(l, @font, @font_size)
250
+ this_x = txt_pos - (this_width + sub_width) / 2
251
+ new_main << "<tspan x='#{this_x}' y='#{main_y}'>#{l}</tspan>"
252
+ @height = main_y if main_y > @height
253
+ end
254
+ main = new_main
255
+ end
219
256
  @tree_data += main_data.sub(/TD/, "text-decoration='#{main_decoration}'")
220
- .sub(/ST/, main_style)
221
- .sub(/WA/, main_weight)
257
+ .sub(/ST/, main_style + ";")
258
+ .sub(/WA/, main_weight + ";")
222
259
  .sub(/CONTENT/, main)
223
260
 
224
261
  # Draw subscript text
225
- sub_data = @text_styles.sub(/COLOR/, col)
226
- sub_data = sub_data.sub(/FONT_SIZE/, @sub_size.to_s)
227
- sub_x = main_x + main_width
228
- sub_y = top + (@e_height - @m[:e_padd] + @sub_size / 10)
229
- if (sub.length > 0 )
230
- sub_data = sub_data.sub(/X_VALUE/, sub_x.ceil.to_s)
231
- sub_data = sub_data.sub(/Y_VALUE/, sub_y.ceil.to_s)
262
+ if sub && sub != ""
263
+ sub_data = @text_styles.sub(/COLOR/, col)
264
+ sub_data = sub_data.sub(/FONT_SIZE/, @sub_size.to_s)
265
+ sub_x = right - sub_width
266
+ sub_y = main_y + sub_height / 4
267
+ sub_data = sub_data.sub(/X_VALUE/, sub_x.to_s)
268
+ sub_data = sub_data.sub(/Y_VALUE/, sub_y.to_s)
232
269
  @tree_data += sub_data.sub(/TD/, "text-decoration='#{sub_decoration}'")
233
270
  .sub(/ST/, sub_style)
234
271
  .sub(/WA/, sub_weight)
235
- .sub(/CONTENT/, sub)
272
+ .sub(/CONTENT/, sub)
273
+ @height += sub_height / 4
236
274
  end
237
275
  end
238
276
 
@@ -248,10 +286,10 @@ EOD
248
286
  toBot = (row2px(fromY - 1 ) + @e_height)
249
287
  toLeft = (toX + toW / 2 + @m[:b_side])
250
288
 
251
- line_data = @line_styles.sub(/X1/, fromLeft.ceil.to_s)
252
- line_data = line_data.sub(/Y1/, fromTop.ceil.to_s)
253
- line_data = line_data.sub(/X2/, toLeft.ceil.to_s)
254
- @tree_data += line_data.sub(/Y2/, toBot.ceil.to_s)
289
+ line_data = @line_styles.sub(/X1/, fromLeft.to_s)
290
+ line_data = line_data.sub(/Y1/, fromTop.to_s)
291
+ line_data = line_data.sub(/X2/, toLeft.to_s)
292
+ @tree_data += line_data.sub(/Y2/, toBot.to_s)
255
293
 
256
294
  end
257
295
 
@@ -264,9 +302,9 @@ EOD
264
302
  toX = fromX
265
303
  fromCenter = (fromX + fromW / 2 + @m[:b_side])
266
304
 
267
- fromTop = row2px(fromY).ceil
268
- fromLeft1 = (fromCenter + textW / 2).ceil
269
- fromLeft2 = (fromCenter - textW / 2).ceil
305
+ fromTop = row2px(fromY)
306
+ fromLeft1 = (fromCenter + textW / 2)
307
+ fromLeft2 = (fromCenter - textW / 2)
270
308
  toBot = (row2px(fromY - 1) + @e_height)
271
309
 
272
310
  if symmetrize
@@ -275,12 +313,12 @@ EOD
275
313
  toLeft = (toX + textW / 2 + @m[:b_side] * 3)
276
314
  end
277
315
 
278
- polygon_data = @polygon_styles.sub(/X1/, fromLeft1.ceil.to_s)
279
- polygon_data = polygon_data.sub(/Y1/, fromTop.ceil.to_s)
280
- polygon_data = polygon_data.sub(/X2/, fromLeft2.ceil.to_s)
281
- polygon_data = polygon_data.sub(/Y2/, fromTop.ceil.to_s)
282
- polygon_data = polygon_data.sub(/X3/, toLeft.ceil.to_s)
283
- @tree_data += polygon_data.sub(/Y3/, toBot.ceil.to_s)
316
+ polygon_data = @polygon_styles.sub(/X1/, fromLeft1.to_s)
317
+ polygon_data = polygon_data.sub(/Y1/, fromTop.to_s)
318
+ polygon_data = polygon_data.sub(/X2/, fromLeft2.to_s)
319
+ polygon_data = polygon_data.sub(/Y2/, fromTop.to_s)
320
+ polygon_data = polygon_data.sub(/X3/, toLeft.to_s)
321
+ @tree_data += polygon_data.sub(/Y3/, toBot.to_s)
284
322
  end
285
323
 
286
324
  # If a node element text is wider than the sum of it's
@@ -292,9 +330,9 @@ EOD
292
330
  children = @e_list.get_children(id)
293
331
  @e_list.set_element_width(id, target)
294
332
 
295
- if(children.length > 0 )
333
+ if(children.length > 0 )
296
334
  delta = target - current
297
- target_delta = delta / children.length
335
+ target_delta = delta / children.length
298
336
 
299
337
  children.each do |child|
300
338
  child_width = @e_list.get_element_width(child)
@@ -303,7 +341,7 @@ EOD
303
341
  end
304
342
  end
305
343
 
306
- def img_get_txt_width(text, font, font_size, multiline = false)
344
+ def img_get_txt_width(text, font, font_size, multiline = true)
307
345
  parts = text.split("_", 2)
308
346
  main_before = parts[0].strip
309
347
  sub = parts[1]
@@ -311,9 +349,15 @@ EOD
311
349
  main_metrics = img_get_txt_metrics(main, font, font_size, multiline)
312
350
  width = main_metrics.width
313
351
  if sub
314
- sub_metrics = img_get_txt_metrics(sub, font, font_size * SUBSCRIPT_CONST, multiline)
352
+ sub_metrics = img_get_txt_metrics(sub.strip, font, font_size * SUBSCRIPT_CONST, multiline)
315
353
  width += sub_metrics.width
316
354
  end
317
355
  return width
318
356
  end
357
+
358
+ def img_get_txt_height(text, font, font_size)
359
+ main_metrics = img_get_txt_metrics(text, font, font_size, false)
360
+ main_metrics.height
361
+ end
362
+
319
363
  end
@@ -53,7 +53,8 @@ class TreeGraph < Graph
53
53
  if @transparent
54
54
  @im.matte_reset!
55
55
  end
56
- @im.interlace = PlaneInterlace
56
+ # @im.interlace = PlaneInterlace
57
+ @im.interlace = LineInterlace
57
58
  @gc.draw(@im)
58
59
  end
59
60
 
@@ -81,7 +82,6 @@ class TreeGraph < Graph
81
82
 
82
83
  # Add the element into the tree (draw it)
83
84
  def draw_element(x, y, w, string, type)
84
- numlines = string.count("\n")
85
85
  string = string.sub(/\^\z/){""}
86
86
  # Calculate element dimensions and position
87
87
  if (type == ETYPE_LEAF) and @leafstyle == "nothing"
@@ -90,7 +90,6 @@ class TreeGraph < Graph
90
90
  top = row2px(y)
91
91
  end
92
92
  left = x + @m[:b_side]
93
- bottom = top + @e_height * numlines
94
93
  right = left + w
95
94
 
96
95
  # Split the string into the main part and the
@@ -144,7 +143,14 @@ class TreeGraph < Graph
144
143
  # Calculate text size for the main and the
145
144
  # subscript part of the element
146
145
 
147
- main_width = img_get_txt_width(main, main_font, @font_size)
146
+
147
+ main_width = 0
148
+ main_height = 0
149
+ main.split(/\\n/).each do |l|
150
+ l_width = img_get_txt_width(l, main_font, @font_size)
151
+ main_width = l_width if main_width < l_width
152
+ main_height += img_get_txt_height(l, @font, @font_size)
153
+ end
148
154
 
149
155
  if /\A\=(.+)\=\z/ =~ sub
150
156
  sub = $1
@@ -183,15 +189,16 @@ class TreeGraph < Graph
183
189
  end
184
190
 
185
191
  if sub != ""
192
+ # add a separation of the width of "M"
186
193
  sub_width = img_get_txt_width(sub.to_s, sub_font, @sub_size)
194
+ sub_height = img_get_txt_height(sub.to_s, sub_font, @sub_size)
187
195
  else
188
196
  sub_width = 0
197
+ sub_height = 0
189
198
  end
190
199
 
191
200
  # Center text in the element
192
- txt_width = main_width + sub_width
193
-
194
- txt_pos = left + (right - left) / 2 - txt_width / 2
201
+ txt_pos = left + (right - left) / 2
195
202
 
196
203
  # Select apropriate color
197
204
  if(type == ETYPE_LEAF)
@@ -209,22 +216,33 @@ class TreeGraph < Graph
209
216
 
210
217
  # Draw main text
211
218
  @gc.pointsize(@font_size)
212
- main_x = txt_pos
219
+ @gc.kerning = 0
220
+ @gc.interline_spacing = 0
221
+ @gc.interword_spacing = 0
222
+
223
+ main_x = txt_pos - sub_width / 2
213
224
  main_y = top + @e_height - @m[:e_padd]
214
225
 
215
- @gc.interline_spacing = -(@main_height / 3)
226
+ # @gc.interline_spacing = -(@main_height / 3)
216
227
  @gc.font(main_font)
217
228
  @gc.decorate(main_decoration)
218
- @gc.text(main_x.ceil, main_y.ceil, main)
229
+ numlines = main.count("\\n")
230
+ if numlines > 1
231
+ @height = @height + @main_height * numlines
232
+ end
233
+ @gc.text_align(CenterAlign)
234
+ @gc.text(main_x.ceil, main_y.ceil, main.gsub("\\n", "\n"))
219
235
 
220
236
  # Draw subscript text
221
- if (sub.length > 0 )
237
+ if (sub != "" )
222
238
  @gc.pointsize(@sub_size)
223
- sub_x = txt_pos + main_width + @sub_space_width
224
- sub_y = top + (@e_height - @m[:e_padd] + @sub_size / 2)
239
+ sub_x = main_x + (main_width / 2) + (sub_width / 2)
240
+ sub_y = top + main_height + sub_height / 4
241
+ @height += sub_height / 4
225
242
  @gc.font(sub_font)
226
243
  @gc.decorate(sub_decoration)
227
- @gc.text(sub_x.ceil, sub_y.ceil, sub)
244
+ @gc.text_align(CenterAlign)
245
+ @gc.text(sub_x.ceil, sub_y.ceil, " " + sub.gsub("\\n", "\n"))
228
246
  end
229
247
  end
230
248
 
@@ -259,6 +277,7 @@ class TreeGraph < Graph
259
277
  fromLeft1 = (fromCenter + textW / 2).ceil
260
278
  fromLeft2 = (fromCenter - textW / 2).ceil
261
279
  toBot = (row2px(fromY - 1) + @e_height)
280
+
262
281
  if symmetrize
263
282
  toLeft = (toX + textW / 2 + @m[:b_side])
264
283
  else
@@ -1,4 +1,4 @@
1
1
  module RSyntaxTree
2
- VERSION = "0.8.8"
2
+ VERSION = "0.9.1"
3
3
  end
4
4
 
data/lib/rsyntaxtree.rb CHANGED
@@ -40,7 +40,8 @@ class RSGenerator
40
40
  key = keystr.to_sym
41
41
  case key
42
42
  when :data
43
- data = CGI.unescape(value)
43
+ data = value
44
+ # data = CGI.unescape(value)
44
45
  data = data.gsub('-AMP-', '&')
45
46
  .gsub('-PERCENT-', "%")
46
47
  .gsub('-PRIME-', "'")
@@ -64,7 +65,7 @@ class RSGenerator
64
65
  new_params[:font_bd] = FONT_DIR + "/NotoSans-Bold.ttf"
65
66
  new_params[:font_bdit] = FONT_DIR + "/NotoSans-BoldItalic.ttf"
66
67
  new_params[:font_math] = FONT_DIR + "/NotoSansMath-Regular.ttf"
67
- new_params[:font_cjk] = FONT_DIR + "/NotoSansCJKjp-Regular.otf"
68
+ new_params[:font_cjk] = FONT_DIR + "/NotoSansJP-Regular.otf"
68
69
  new_params[:fontstyle] = "sans"
69
70
  elsif value == "noto-serif" || value == "serif"
70
71
  new_params[:font] = FONT_DIR + "/NotoSerif-Regular.ttf"
@@ -72,7 +73,7 @@ class RSGenerator
72
73
  new_params[:font_bd] = FONT_DIR + "/NotoSerif-Bold.ttf"
73
74
  new_params[:font_bdit] = FONT_DIR + "/NotoSerif-BoldItalic.ttf"
74
75
  new_params[:font_math] = FONT_DIR + "/NotoSansMath-Regular.ttf"
75
- new_params[:font_cjk] = FONT_DIR + "/NotoSerifCJKjp-Regular.otf"
76
+ new_params[:font_cjk] = FONT_DIR + "/NotoSerifJP-Regular.otf"
76
77
  new_params[:fontstyle] = "serif"
77
78
  elsif value == "cjk zenhei" || value == "cjk"
78
79
  new_params[:font] = FONT_DIR + "/wqy-zenhei.ttf"
@@ -88,7 +89,7 @@ class RSGenerator
88
89
  new_params[:font_bd] = FONT_DIR + "/lmroman10-bold.otf"
89
90
  new_params[:font_bdit] = FONT_DIR + "/lmroman10-bolditalic.otf"
90
91
  new_params[:font_math] = FONT_DIR + "/latinmodern-math.otf"
91
- new_params[:font_cjk] = FONT_DIR + "/NotoSerifCJKjp-Regular.otf"
92
+ new_params[:font_cjk] = FONT_DIR + "/NotoSerifJP-Regular.otf"
92
93
  new_params[:fontstyle] = "math"
93
94
  end
94
95
  else
@@ -110,19 +111,25 @@ class RSGenerator
110
111
  :margin => 0,
111
112
  :vheight => 1.0,
112
113
  :fontstyle => "sans",
113
- :font => "/NotoSansCJKjp-Regular.otf",
114
+ :font => "/NotoSansJP-Regular.otf",
114
115
  :font_it => "/NotoSans-Italic.ttf",
115
116
  :font_bd => "/NotoSans-Bold.ttf",
116
117
  :font_bdit => "/NotoSans-BoldItalic.ttf",
117
118
  :font_math => "/NotoSansMath-Regular.ttf"
118
119
  }
119
120
  @metrics = {
120
- :e_width => 120,
121
- :e_padd => 14,
122
- :v_space => 20,
123
- :h_space => 20,
124
- :b_side => 10,
125
- :b_topbot => 10
121
+ :e_width => 0,
122
+ :e_padd => 20,
123
+ :v_space => 0,
124
+ :h_space => 0,
125
+ :b_side => 0,
126
+ :b_topbot => 0
127
+ # :e_width => 120,
128
+ # :e_padd => 14,
129
+ # :v_space => 20,
130
+ # :h_space => 20,
131
+ # :b_side => 10,
132
+ # :b_topbot => 10
126
133
  }
127
134
 
128
135
  @params.merge! new_params
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsyntaxtree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoichiro Hasebe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-04 00:00:00.000000000 Z
11
+ date: 2021-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rmagick
@@ -67,13 +67,15 @@ files:
67
67
  - fonts/NotoSans-BoldItalic.ttf
68
68
  - fonts/NotoSans-Italic.ttf
69
69
  - fonts/NotoSans-Regular.ttf
70
- - fonts/NotoSansCJKjp-Regular.otf
70
+ - fonts/NotoSansJP-Bold.otf
71
+ - fonts/NotoSansJP-Regular.otf
71
72
  - fonts/NotoSansMath-Regular.ttf
72
73
  - fonts/NotoSerif-Bold.ttf
73
74
  - fonts/NotoSerif-BoldItalic.ttf
74
75
  - fonts/NotoSerif-Italic.ttf
75
76
  - fonts/NotoSerif-Regular.ttf
76
- - fonts/NotoSerifCJKjp-Regular.otf
77
+ - fonts/NotoSerifJP-Bold.otf
78
+ - fonts/NotoSerifJP-Regular.otf
77
79
  - fonts/latinmodern-math.otf
78
80
  - fonts/lmroman10-bold.otf
79
81
  - fonts/lmroman10-bolditalic.otf
Binary file
Binary file