mathematical 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +52 -10
  3. data/Rakefile +42 -3
  4. data/lib/mathematical.rb +5 -4
  5. data/lib/mathematical/mathematical.bundle +0 -0
  6. data/lib/mathematical/render.rb +6 -5
  7. data/lib/mathematical/version.rb +1 -1
  8. data/mathematical.gemspec +5 -5
  9. metadata +14 -296
  10. data/.gitignore +0 -24
  11. data/.gitmodules +0 -0
  12. data/Gemfile +0 -4
  13. data/ext/mathematical/README.itex2MML.md +0 -11
  14. data/ext/mathematical/README.lasem.md +0 -11
  15. data/ext/mathematical/extconf.rb +0 -51
  16. data/ext/mathematical/itex2MML.h +0 -63
  17. data/ext/mathematical/lasemrender.c +0 -257
  18. data/ext/mathematical/lex.yy.c +0 -6548
  19. data/ext/mathematical/lsm.c +0 -30
  20. data/ext/mathematical/lsm.h +0 -36
  21. data/ext/mathematical/lsmattributes.c +0 -279
  22. data/ext/mathematical/lsmattributes.h +0 -75
  23. data/ext/mathematical/lsmcairo.c +0 -598
  24. data/ext/mathematical/lsmcairo.h +0 -51
  25. data/ext/mathematical/lsmdebug.c +0 -179
  26. data/ext/mathematical/lsmdebug.h +0 -76
  27. data/ext/mathematical/lsmdom.h +0 -43
  28. data/ext/mathematical/lsmdomcharacterdata.c +0 -114
  29. data/ext/mathematical/lsmdomcharacterdata.h +0 -59
  30. data/ext/mathematical/lsmdomdocument.c +0 -292
  31. data/ext/mathematical/lsmdomdocument.h +0 -82
  32. data/ext/mathematical/lsmdomdocumentfragment.c +0 -81
  33. data/ext/mathematical/lsmdomdocumentfragment.h +0 -55
  34. data/ext/mathematical/lsmdomelement.c +0 -148
  35. data/ext/mathematical/lsmdomelement.h +0 -62
  36. data/ext/mathematical/lsmdomentities.c +0 -2155
  37. data/ext/mathematical/lsmdomentities.h +0 -35
  38. data/ext/mathematical/lsmdomenumtypes.c +0 -99
  39. data/ext/mathematical/lsmdomenumtypes.c.template +0 -39
  40. data/ext/mathematical/lsmdomenumtypes.h +0 -26
  41. data/ext/mathematical/lsmdomenumtypes.h.template +0 -26
  42. data/ext/mathematical/lsmdomimplementation.c +0 -82
  43. data/ext/mathematical/lsmdomimplementation.h +0 -41
  44. data/ext/mathematical/lsmdomnamednodemap.c +0 -118
  45. data/ext/mathematical/lsmdomnamednodemap.h +0 -64
  46. data/ext/mathematical/lsmdomnode.c +0 -725
  47. data/ext/mathematical/lsmdomnode.h +0 -120
  48. data/ext/mathematical/lsmdomnodelist.c +0 -70
  49. data/ext/mathematical/lsmdomnodelist.h +0 -58
  50. data/ext/mathematical/lsmdomparser.c +0 -461
  51. data/ext/mathematical/lsmdomparser.h +0 -54
  52. data/ext/mathematical/lsmdomtext.c +0 -82
  53. data/ext/mathematical/lsmdomtext.h +0 -55
  54. data/ext/mathematical/lsmdomtypes.h +0 -44
  55. data/ext/mathematical/lsmdomview.c +0 -422
  56. data/ext/mathematical/lsmdomview.h +0 -94
  57. data/ext/mathematical/lsmmathml.h +0 -66
  58. data/ext/mathematical/lsmmathmlactionelement.c +0 -93
  59. data/ext/mathematical/lsmmathmlactionelement.h +0 -57
  60. data/ext/mathematical/lsmmathmlaligngroupelement.c +0 -102
  61. data/ext/mathematical/lsmmathmlaligngroupelement.h +0 -56
  62. data/ext/mathematical/lsmmathmlalignmarkelement.c +0 -102
  63. data/ext/mathematical/lsmmathmlalignmarkelement.h +0 -56
  64. data/ext/mathematical/lsmmathmlattributes.c +0 -197
  65. data/ext/mathematical/lsmmathmlattributes.h +0 -126
  66. data/ext/mathematical/lsmmathmldocument.c +0 -306
  67. data/ext/mathematical/lsmmathmldocument.h +0 -61
  68. data/ext/mathematical/lsmmathmlelement.c +0 -491
  69. data/ext/mathematical/lsmmathmlelement.h +0 -107
  70. data/ext/mathematical/lsmmathmlenums.c +0 -429
  71. data/ext/mathematical/lsmmathmlenums.h +0 -182
  72. data/ext/mathematical/lsmmathmlenumtypes.c +0 -666
  73. data/ext/mathematical/lsmmathmlenumtypes.c.template +0 -39
  74. data/ext/mathematical/lsmmathmlenumtypes.h +0 -90
  75. data/ext/mathematical/lsmmathmlenumtypes.h.template +0 -26
  76. data/ext/mathematical/lsmmathmlerrorelement.c +0 -58
  77. data/ext/mathematical/lsmmathmlerrorelement.h +0 -56
  78. data/ext/mathematical/lsmmathmlfencedelement.c +0 -178
  79. data/ext/mathematical/lsmmathmlfencedelement.h +0 -65
  80. data/ext/mathematical/lsmmathmlfractionelement.c +0 -253
  81. data/ext/mathematical/lsmmathmlfractionelement.h +0 -62
  82. data/ext/mathematical/lsmmathmlglyphtableams.c +0 -597
  83. data/ext/mathematical/lsmmathmlglyphtableams.h +0 -45
  84. data/ext/mathematical/lsmmathmlitexelement.c +0 -187
  85. data/ext/mathematical/lsmmathmlitexelement.h +0 -60
  86. data/ext/mathematical/lsmmathmllayoututils.c +0 -191
  87. data/ext/mathematical/lsmmathmllayoututils.h +0 -58
  88. data/ext/mathematical/lsmmathmlmathelement.c +0 -204
  89. data/ext/mathematical/lsmmathmlmathelement.h +0 -81
  90. data/ext/mathematical/lsmmathmloperatordictionary.c +0 -3332
  91. data/ext/mathematical/lsmmathmloperatordictionary.h +0 -54
  92. data/ext/mathematical/lsmmathmloperatorelement.c +0 -307
  93. data/ext/mathematical/lsmmathmloperatorelement.h +0 -73
  94. data/ext/mathematical/lsmmathmlpaddedelement.c +0 -58
  95. data/ext/mathematical/lsmmathmlpaddedelement.h +0 -56
  96. data/ext/mathematical/lsmmathmlphantomelement.c +0 -71
  97. data/ext/mathematical/lsmmathmlphantomelement.h +0 -56
  98. data/ext/mathematical/lsmmathmlpresentationcontainer.c +0 -43
  99. data/ext/mathematical/lsmmathmlpresentationcontainer.h +0 -54
  100. data/ext/mathematical/lsmmathmlpresentationtoken.c +0 -303
  101. data/ext/mathematical/lsmmathmlpresentationtoken.h +0 -83
  102. data/ext/mathematical/lsmmathmlradicalelement.c +0 -266
  103. data/ext/mathematical/lsmmathmlradicalelement.h +0 -71
  104. data/ext/mathematical/lsmmathmlrowelement.c +0 -58
  105. data/ext/mathematical/lsmmathmlrowelement.h +0 -56
  106. data/ext/mathematical/lsmmathmlscriptelement.c +0 -282
  107. data/ext/mathematical/lsmmathmlscriptelement.h +0 -78
  108. data/ext/mathematical/lsmmathmlsemanticselement.c +0 -82
  109. data/ext/mathematical/lsmmathmlsemanticselement.h +0 -56
  110. data/ext/mathematical/lsmmathmlspaceelement.c +0 -142
  111. data/ext/mathematical/lsmmathmlspaceelement.h +0 -60
  112. data/ext/mathematical/lsmmathmlstringelement.c +0 -123
  113. data/ext/mathematical/lsmmathmlstringelement.h +0 -58
  114. data/ext/mathematical/lsmmathmlstyle.c +0 -130
  115. data/ext/mathematical/lsmmathmlstyle.h +0 -81
  116. data/ext/mathematical/lsmmathmlstyleelement.c +0 -307
  117. data/ext/mathematical/lsmmathmlstyleelement.h +0 -87
  118. data/ext/mathematical/lsmmathmltablecellelement.c +0 -122
  119. data/ext/mathematical/lsmmathmltablecellelement.h +0 -62
  120. data/ext/mathematical/lsmmathmltableelement.c +0 -545
  121. data/ext/mathematical/lsmmathmltableelement.h +0 -78
  122. data/ext/mathematical/lsmmathmltablerowelement.c +0 -120
  123. data/ext/mathematical/lsmmathmltablerowelement.h +0 -64
  124. data/ext/mathematical/lsmmathmltraits.c +0 -819
  125. data/ext/mathematical/lsmmathmltraits.h +0 -119
  126. data/ext/mathematical/lsmmathmltypes.h +0 -66
  127. data/ext/mathematical/lsmmathmlunderoverelement.c +0 -485
  128. data/ext/mathematical/lsmmathmlunderoverelement.h +0 -82
  129. data/ext/mathematical/lsmmathmlutils.c +0 -170
  130. data/ext/mathematical/lsmmathmlutils.h +0 -50
  131. data/ext/mathematical/lsmmathmlview.c +0 -1048
  132. data/ext/mathematical/lsmmathmlview.h +0 -164
  133. data/ext/mathematical/lsmproperties.c +0 -418
  134. data/ext/mathematical/lsmproperties.h +0 -85
  135. data/ext/mathematical/lsmstr.c +0 -231
  136. data/ext/mathematical/lsmstr.h +0 -114
  137. data/ext/mathematical/lsmsvg.h +0 -67
  138. data/ext/mathematical/lsmsvgaelement.c +0 -73
  139. data/ext/mathematical/lsmsvgaelement.h +0 -55
  140. data/ext/mathematical/lsmsvgattributes.h +0 -113
  141. data/ext/mathematical/lsmsvgcircleelement.c +0 -153
  142. data/ext/mathematical/lsmsvgcircleelement.h +0 -59
  143. data/ext/mathematical/lsmsvgclippathelement.c +0 -134
  144. data/ext/mathematical/lsmsvgclippathelement.h +0 -59
  145. data/ext/mathematical/lsmsvgcolors.c +0 -212
  146. data/ext/mathematical/lsmsvgcolors.h +0 -39
  147. data/ext/mathematical/lsmsvgdefselement.c +0 -74
  148. data/ext/mathematical/lsmsvgdefselement.h +0 -55
  149. data/ext/mathematical/lsmsvgdocument.c +0 -230
  150. data/ext/mathematical/lsmsvgdocument.h +0 -58
  151. data/ext/mathematical/lsmsvgelement.c +0 -367
  152. data/ext/mathematical/lsmsvgelement.h +0 -81
  153. data/ext/mathematical/lsmsvgellipseelement.c +0 -158
  154. data/ext/mathematical/lsmsvgellipseelement.h +0 -60
  155. data/ext/mathematical/lsmsvgenums.c +0 -544
  156. data/ext/mathematical/lsmsvgenums.h +0 -357
  157. data/ext/mathematical/lsmsvgenumtypes.c +0 -1083
  158. data/ext/mathematical/lsmsvgenumtypes.c.template +0 -39
  159. data/ext/mathematical/lsmsvgenumtypes.h +0 -111
  160. data/ext/mathematical/lsmsvgenumtypes.h.template +0 -26
  161. data/ext/mathematical/lsmsvgfilterblend.c +0 -105
  162. data/ext/mathematical/lsmsvgfilterblend.h +0 -58
  163. data/ext/mathematical/lsmsvgfiltercomposite.c +0 -109
  164. data/ext/mathematical/lsmsvgfiltercomposite.h +0 -58
  165. data/ext/mathematical/lsmsvgfilterelement.c +0 -266
  166. data/ext/mathematical/lsmsvgfilterelement.h +0 -66
  167. data/ext/mathematical/lsmsvgfilterflood.c +0 -86
  168. data/ext/mathematical/lsmsvgfilterflood.h +0 -55
  169. data/ext/mathematical/lsmsvgfiltergaussianblur.c +0 -114
  170. data/ext/mathematical/lsmsvgfiltergaussianblur.h +0 -57
  171. data/ext/mathematical/lsmsvgfiltermerge.c +0 -98
  172. data/ext/mathematical/lsmsvgfiltermerge.h +0 -55
  173. data/ext/mathematical/lsmsvgfiltermergenode.c +0 -87
  174. data/ext/mathematical/lsmsvgfiltermergenode.h +0 -57
  175. data/ext/mathematical/lsmsvgfilteroffset.c +0 -112
  176. data/ext/mathematical/lsmsvgfilteroffset.h +0 -58
  177. data/ext/mathematical/lsmsvgfilterprimitive.c +0 -168
  178. data/ext/mathematical/lsmsvgfilterprimitive.h +0 -66
  179. data/ext/mathematical/lsmsvgfilterspecularlighting.c +0 -127
  180. data/ext/mathematical/lsmsvgfilterspecularlighting.h +0 -60
  181. data/ext/mathematical/lsmsvgfiltersurface.c +0 -455
  182. data/ext/mathematical/lsmsvgfiltersurface.h +0 -66
  183. data/ext/mathematical/lsmsvgfiltertile.c +0 -102
  184. data/ext/mathematical/lsmsvgfiltertile.h +0 -57
  185. data/ext/mathematical/lsmsvggelement.c +0 -73
  186. data/ext/mathematical/lsmsvggelement.h +0 -55
  187. data/ext/mathematical/lsmsvggradientelement.c +0 -151
  188. data/ext/mathematical/lsmsvggradientelement.h +0 -68
  189. data/ext/mathematical/lsmsvgimageelement.c +0 -261
  190. data/ext/mathematical/lsmsvgimageelement.h +0 -67
  191. data/ext/mathematical/lsmsvglength.c +0 -93
  192. data/ext/mathematical/lsmsvglength.h +0 -59
  193. data/ext/mathematical/lsmsvglineargradientelement.c +0 -271
  194. data/ext/mathematical/lsmsvglineargradientelement.h +0 -60
  195. data/ext/mathematical/lsmsvglineelement.c +0 -153
  196. data/ext/mathematical/lsmsvglineelement.h +0 -60
  197. data/ext/mathematical/lsmsvgmarkerelement.c +0 -266
  198. data/ext/mathematical/lsmsvgmarkerelement.h +0 -74
  199. data/ext/mathematical/lsmsvgmaskelement.c +0 -232
  200. data/ext/mathematical/lsmsvgmaskelement.h +0 -64
  201. data/ext/mathematical/lsmsvgmatrix.c +0 -205
  202. data/ext/mathematical/lsmsvgmatrix.h +0 -59
  203. data/ext/mathematical/lsmsvgpathelement.c +0 -115
  204. data/ext/mathematical/lsmsvgpathelement.h +0 -59
  205. data/ext/mathematical/lsmsvgpatternelement.c +0 -398
  206. data/ext/mathematical/lsmsvgpatternelement.h +0 -69
  207. data/ext/mathematical/lsmsvgpolygonelement.c +0 -106
  208. data/ext/mathematical/lsmsvgpolygonelement.h +0 -57
  209. data/ext/mathematical/lsmsvgpolylineelement.c +0 -106
  210. data/ext/mathematical/lsmsvgpolylineelement.h +0 -57
  211. data/ext/mathematical/lsmsvgradialgradientelement.c +0 -323
  212. data/ext/mathematical/lsmsvgradialgradientelement.h +0 -61
  213. data/ext/mathematical/lsmsvgrectelement.c +0 -184
  214. data/ext/mathematical/lsmsvgrectelement.h +0 -62
  215. data/ext/mathematical/lsmsvgstopelement.c +0 -106
  216. data/ext/mathematical/lsmsvgstopelement.h +0 -57
  217. data/ext/mathematical/lsmsvgstyle.c +0 -558
  218. data/ext/mathematical/lsmsvgstyle.h +0 -217
  219. data/ext/mathematical/lsmsvgsvgelement.c +0 -260
  220. data/ext/mathematical/lsmsvgsvgelement.h +0 -71
  221. data/ext/mathematical/lsmsvgswitchelement.c +0 -103
  222. data/ext/mathematical/lsmsvgswitchelement.h +0 -55
  223. data/ext/mathematical/lsmsvgsymbolelement.c +0 -74
  224. data/ext/mathematical/lsmsvgsymbolelement.h +0 -55
  225. data/ext/mathematical/lsmsvgtextelement.c +0 -170
  226. data/ext/mathematical/lsmsvgtextelement.h +0 -58
  227. data/ext/mathematical/lsmsvgtraits.c +0 -1158
  228. data/ext/mathematical/lsmsvgtraits.h +0 -103
  229. data/ext/mathematical/lsmsvgtransformable.c +0 -106
  230. data/ext/mathematical/lsmsvgtransformable.h +0 -54
  231. data/ext/mathematical/lsmsvgtspanelement.c +0 -143
  232. data/ext/mathematical/lsmsvgtspanelement.h +0 -58
  233. data/ext/mathematical/lsmsvgtypes.h +0 -77
  234. data/ext/mathematical/lsmsvguseelement.c +0 -237
  235. data/ext/mathematical/lsmsvguseelement.h +0 -69
  236. data/ext/mathematical/lsmsvgview.c +0 -2400
  237. data/ext/mathematical/lsmsvgview.h +0 -168
  238. data/ext/mathematical/lsmtraits.c +0 -119
  239. data/ext/mathematical/lsmtraits.h +0 -49
  240. data/ext/mathematical/lsmtypes.h +0 -36
  241. data/ext/mathematical/lsmutils.c +0 -54
  242. data/ext/mathematical/lsmutils.h +0 -56
  243. data/ext/mathematical/mathematical.c +0 -122
  244. data/ext/mathematical/y.tab.c +0 -6179
  245. data/ext/mathematical/y.tab.h +0 -389
  246. data/script/bench +0 -21
  247. data/script/bootstrap +0 -9
  248. data/script/single_test +0 -7
  249. data/test/mathematical/basic_test.rb +0 -38
  250. data/test/mathematical/fixtures/after/brackets_display.html +0 -1
  251. data/test/mathematical/fixtures/after/dollar_sign_inline.html +0 -1
  252. data/test/mathematical/fixtures/after/equation_display.html +0 -1
  253. data/test/mathematical/fixtures/after/multiple_dollar_inline.html +0 -1
  254. data/test/mathematical/fixtures/after/parens_inline.html +0 -1
  255. data/test/mathematical/fixtures/before/brackets_display.text +0 -1
  256. data/test/mathematical/fixtures/before/dollar_sign_inline.text +0 -1
  257. data/test/mathematical/fixtures/before/equation_display.text +0 -1
  258. data/test/mathematical/fixtures/before/multiple_dollar_inline.text +0 -1
  259. data/test/mathematical/fixtures/before/parens_inline.text +0 -1
  260. data/test/mathematical/fixtures/performance/big_file.text +0 -1767
  261. data/test/mathematical/fixtures_test.rb +0 -31
  262. data/test/mathematical/performance_test.rb +0 -13
  263. data/test/test_helper.rb +0 -4
@@ -1,558 +0,0 @@
1
- /* Lasem
2
- *
3
- * Copyright © 2009 Emmanuel Pacaud
4
- *
5
- * This library is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU Lesser General Public
7
- * License as published by the Free Software Foundation; either
8
- * version 2 of the License, or (at your option) any later version.
9
- *
10
- * This library is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- * Lesser General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Lesser General
16
- * Public License along with this library; if not, write to the
17
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18
- * Boston, MA 02111-1307, USA.
19
- *
20
- * Author:
21
- * Emmanuel Pacaud <emmanuel@gnome.org>
22
- */
23
-
24
- #include <lsmsvgstyle.h>
25
- #include <lsmsvgcolors.h>
26
- #include <lsmsvgtraits.h>
27
- #include <lsm.h>
28
- #include <string.h>
29
- #include <math.h>
30
-
31
- static const LsmPropertyInfos lsm_svg_property_infos[] = {
32
- {
33
- .name = "alignment-baseline",
34
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, alignment_baseline),
35
- .trait_class = &lsm_null_trait_class,
36
- .trait_default = "auto" /* FIXME specification says "see property description" */
37
- },
38
- {
39
- .name = "baseline-shift",
40
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, baseline_shift),
41
- .trait_class = &lsm_null_trait_class,
42
- .trait_default = "baseline"
43
- },
44
- {
45
- .name = "clip",
46
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, clip),
47
- .trait_class = &lsm_null_trait_class,
48
- .trait_default = "auto"
49
- },
50
- {
51
- .name = "clip-path",
52
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, clip_path),
53
- .trait_class = &lsm_null_trait_class,
54
- .trait_default = "none"
55
- },
56
- {
57
- .name = "comp-op",
58
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, comp_op),
59
- .trait_class = &lsm_svg_comp_op_trait_class,
60
- .trait_default = "src-over"
61
- },
62
- {
63
- .name = "dominant-baseline",
64
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, dominant_baseline),
65
- .trait_class = &lsm_null_trait_class,
66
- .trait_default = "auto"
67
- },
68
- {
69
- .name = "enable-background",
70
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, enable_background),
71
- .trait_class = &lsm_svg_enable_background_trait_class,
72
- .trait_default = "accumulate"
73
- },
74
- {
75
- .name = "filter",
76
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, filter),
77
- .trait_class = &lsm_null_trait_class,
78
- .trait_default = "none"
79
- },
80
- {
81
- .name = "flood-color",
82
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, flood_color),
83
- .trait_class = &lsm_svg_color_trait_class,
84
- .trait_default = "black"
85
- },
86
- {
87
- .name = "flood-opacity",
88
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, flood_opacity),
89
- .trait_class = &lsm_double_trait_class,
90
- .trait_default = "1"
91
- },
92
- {
93
- .name = "lighting-color",
94
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, lighting_color),
95
- .trait_class = &lsm_svg_color_trait_class,
96
- .trait_default = "white"
97
- },
98
- {
99
- .name = "mask",
100
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, mask),
101
- .trait_class = &lsm_null_trait_class,
102
- .trait_default = "none"
103
- },
104
- {
105
- .name = "opacity",
106
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, opacity),
107
- .trait_class = &lsm_double_trait_class,
108
- .trait_default = "1"
109
- },
110
- {
111
- .name = "overflow",
112
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, overflow),
113
- .trait_class = &lsm_svg_overflow_trait_class,
114
- .trait_default = "hidden"
115
- },
116
- {
117
- .name = "stop-color",
118
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, stop_color),
119
- .trait_class = &lsm_svg_color_trait_class,
120
- .trait_default = "black"
121
- },
122
- {
123
- .name = "stop-opacity",
124
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, stop_opacity),
125
- .trait_class = &lsm_double_trait_class,
126
- .trait_default = "1"
127
- },
128
- {
129
- .name = "text-decoration",
130
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, text_decoration),
131
- .trait_class = &lsm_null_trait_class,
132
- .trait_default = "none"
133
- },
134
- {
135
- .name = "unicode-bidi",
136
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, unicode_bidi),
137
- .trait_class = &lsm_null_trait_class,
138
- .trait_default = "normal"
139
- },
140
- {
141
- .name = "viewport-fill",
142
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, viewport_fill),
143
- .trait_class = &lsm_svg_paint_trait_class,
144
- .trait_default = "none"
145
- },
146
- {
147
- .name = "viewport-fill-opacity",
148
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, viewport_fill_opacity),
149
- .trait_class = &lsm_double_trait_class,
150
- .trait_default = "1"
151
- },
152
- /* Inherited properties */
153
- {
154
- .name = "clip-rule",
155
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, clip_rule),
156
- .trait_class = &lsm_svg_fill_rule_trait_class,
157
- .trait_default = "nonzero"
158
- },
159
- {
160
- .name = "color",
161
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, color),
162
- .trait_class = &lsm_svg_color_trait_class,
163
- .trait_default = "black" /* Depends on user agent */
164
- },
165
- {
166
- .name = "color-interpolation",
167
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, color_interpolation),
168
- .trait_class = &lsm_null_trait_class,
169
- .trait_default = "sRGB"
170
- },
171
- {
172
- .name = "color-interpolation-filters",
173
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, color_interpolation_filters),
174
- .trait_class = &lsm_null_trait_class,
175
- .trait_default = "linearRGB"
176
- },
177
- {
178
- .name = "color-profile",
179
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, color_profile),
180
- .trait_class = &lsm_null_trait_class,
181
- .trait_default = "auto"
182
- },
183
- {
184
- .name = "color-rendering",
185
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, color_rendering),
186
- .trait_class = &lsm_null_trait_class,
187
- .trait_default = "auto"
188
- },
189
- {
190
- .name = "cursor",
191
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, cursor),
192
- .trait_class = &lsm_null_trait_class,
193
- .trait_default = "auto"
194
- },
195
- {
196
- .name = "direction",
197
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, direction),
198
- .trait_class = &lsm_null_trait_class,
199
- .trait_default = "ltr"
200
- },
201
- {
202
- .name = "display",
203
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, display),
204
- .trait_class = &lsm_svg_display_trait_class,
205
- .trait_default = "inline"
206
- },
207
- {
208
- .name = "fill",
209
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, fill),
210
- .trait_class = &lsm_svg_paint_trait_class,
211
- .trait_default = "black"
212
- },
213
- {
214
- .name = "fill-opacity",
215
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, fill_opacity),
216
- .trait_class = &lsm_double_trait_class,
217
- .trait_default = "1"
218
- },
219
- {
220
- .name = "fill-rule",
221
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, fill_rule),
222
- .trait_class = &lsm_svg_fill_rule_trait_class,
223
- .trait_default = "nonzero"
224
- },
225
- {
226
- .name = "font",
227
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, font),
228
- .trait_class = &lsm_null_trait_class,
229
- .trait_default = NULL /* specification says "See individual properties" */
230
- },
231
- {
232
- .name = "font-family",
233
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, font_family),
234
- .trait_class = &lsm_null_trait_class,
235
- .trait_default = "Sans" /* Depends on user agent */
236
- },
237
- {
238
- .name = "font-size",
239
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, font_size),
240
- .trait_class = &lsm_svg_length_trait_class,
241
- .trait_default = "10pt" /* FIXME Specification says "medium" */
242
- },
243
- {
244
- .name = "font-size-adjust",
245
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, font_size_adjust),
246
- .trait_class = &lsm_null_trait_class,
247
- .trait_default = "none"
248
- },
249
- {
250
- .name = "font-stretch",
251
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, font_stretch),
252
- .trait_class = &lsm_svg_font_stretch_trait_class,
253
- .trait_default = "normal"
254
- },
255
- {
256
- .name = "font-style",
257
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, font_style),
258
- .trait_class = &lsm_svg_font_style_trait_class,
259
- .trait_default = "normal"
260
- },
261
- {
262
- .name = "font-variant",
263
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, font_variant),
264
- .trait_class = &lsm_null_trait_class,
265
- .trait_default = "normal"
266
- },
267
- {
268
- .name = "font-weight",
269
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, font_weight),
270
- .trait_class = &lsm_svg_font_weight_trait_class,
271
- .trait_default = "normal"
272
- },
273
- {
274
- .name = "glyph-orientation-horizontal",
275
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, glyph_orientation_horizontal),
276
- .trait_class = &lsm_null_trait_class,
277
- .trait_default = "0deg"
278
- },
279
- {
280
- .name = "glyph-orientation-vertical",
281
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, glyph_orientation_vertical),
282
- .trait_class = &lsm_null_trait_class,
283
- .trait_default = "auto"
284
- },
285
- {
286
- .name = "image-rendering",
287
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, image_rendering),
288
- .trait_class = &lsm_null_trait_class,
289
- .trait_default = "auto"
290
- },
291
- {
292
- .name = "kerning",
293
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, kerning),
294
- .trait_class = &lsm_null_trait_class,
295
- .trait_default = "auto"
296
- },
297
- {
298
- .name = "letter-spacing",
299
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, letter_spacing),
300
- .trait_class = &lsm_null_trait_class,
301
- .trait_default = "normal"
302
- },
303
- {
304
- .name = "marker",
305
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, marker),
306
- .trait_class = &lsm_null_trait_class,
307
- .trait_default = "none"
308
- },
309
- {
310
- .name = "marker-end",
311
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, marker_end),
312
- .trait_class = &lsm_null_trait_class,
313
- .trait_default = "none"
314
- },
315
- {
316
- .name = "marker-mid",
317
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, marker_mid),
318
- .trait_class = &lsm_null_trait_class,
319
- .trait_default = "none"
320
- },
321
- {
322
- .name = "marker-start",
323
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, marker_start),
324
- .trait_class = &lsm_null_trait_class,
325
- .trait_default = "none"
326
- },
327
- {
328
- .name = "pointer-events",
329
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, pointer_events),
330
- .trait_class = &lsm_null_trait_class,
331
- .trait_default = "visiblePainted"
332
- },
333
- {
334
- .name = "shape-rendering",
335
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, shape_rendering),
336
- .trait_class = &lsm_null_trait_class,
337
- .trait_default = "auto"
338
- },
339
- {
340
- .name = "stroke",
341
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, stroke),
342
- .trait_class = &lsm_svg_paint_trait_class,
343
- .trait_default = "none"
344
- },
345
- {
346
- .name = "stroke-dasharray",
347
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, stroke_dash_array),
348
- .trait_class = &lsm_svg_dash_array_trait_class,
349
- .trait_default = "none"
350
- },
351
- {
352
- .name = "stroke-dashoffset",
353
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, stroke_dash_offset),
354
- .trait_class = &lsm_svg_length_trait_class,
355
- .trait_default = "0"
356
- },
357
- {
358
- .name = "stroke-linecap",
359
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, stroke_line_cap),
360
- .trait_class = &lsm_svg_line_cap_trait_class,
361
- .trait_default = "butt"
362
- },
363
- {
364
- .name = "stroke-linejoin",
365
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, stroke_line_join),
366
- .trait_class = &lsm_svg_line_join_trait_class,
367
- .trait_default = "miter"
368
- },
369
- {
370
- .name = "stroke-miterlimit",
371
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, stroke_miter_limit),
372
- .trait_class = &lsm_double_trait_class,
373
- .trait_default = "4"
374
- },
375
- {
376
- .name = "stroke-opacity",
377
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, stroke_opacity),
378
- .trait_class = &lsm_double_trait_class,
379
- .trait_default = "1"
380
- },
381
- {
382
- .name = "stroke-width",
383
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, stroke_width),
384
- .trait_class = &lsm_svg_length_trait_class,
385
- .trait_default = "1"
386
- },
387
- {
388
- .name = "text-anchor",
389
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, text_anchor),
390
- .trait_class = &lsm_svg_text_anchor_trait_class,
391
- .trait_default = "start"
392
- },
393
- {
394
- .name = "text-rendering",
395
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, text_rendering),
396
- .trait_class = &lsm_null_trait_class,
397
- .trait_default = "auto"
398
- },
399
- {
400
- .name = "visibility",
401
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, visibility),
402
- .trait_class = &lsm_svg_visibility_trait_class,
403
- .trait_default = "visible"
404
- },
405
- {
406
- .name = "word-spacing",
407
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, word_spacing),
408
- .trait_class = &lsm_null_trait_class,
409
- .trait_default = "normal"
410
- },
411
- {
412
- .name = "writing-mode",
413
- .id = LSM_PROPERTY_OFFSET_TO_ID (LsmSvgStyle, writing_mode),
414
- .trait_class = &lsm_svg_writing_mode_trait_class,
415
- .trait_default = "lr-tb"
416
- }
417
- };
418
-
419
- static LsmPropertyManager *
420
- lsm_svg_get_property_manager (void)
421
- {
422
- static LsmPropertyManager *manager = NULL;
423
-
424
- if (G_LIKELY (manager != NULL))
425
- return manager;
426
-
427
- manager = lsm_property_manager_new (G_N_ELEMENTS (lsm_svg_property_infos), lsm_svg_property_infos);
428
-
429
- return manager;
430
- }
431
-
432
- void
433
- lsm_svg_property_bag_set_property (LsmPropertyBag *property_bag, const char *name, const char *value)
434
- {
435
- LsmPropertyManager *property_manager = lsm_svg_get_property_manager ();
436
-
437
- lsm_property_manager_set_property (property_manager, property_bag, name, value);
438
- }
439
-
440
- const char *
441
- lsm_svg_property_bag_get_property (LsmPropertyBag *property_bag, const char *name)
442
- {
443
- LsmPropertyManager *property_manager = lsm_svg_get_property_manager ();
444
-
445
- return lsm_property_manager_get_property (property_manager, property_bag, name);
446
- }
447
-
448
- void
449
- lsm_svg_property_bag_clean (LsmPropertyBag *property_bag)
450
- {
451
- LsmPropertyManager *property_manager = lsm_svg_get_property_manager ();
452
-
453
- lsm_property_manager_clean_properties (property_manager, property_bag);
454
- }
455
-
456
- char *
457
- lsm_svg_property_bag_serialize (LsmPropertyBag *property_bag)
458
- {
459
- LsmPropertyManager *property_manager = lsm_svg_get_property_manager ();
460
-
461
- return lsm_property_manager_serialize (property_manager, property_bag);
462
- }
463
-
464
- typedef struct {
465
- LsmSvgStyle base;
466
-
467
- volatile gint ref_count;
468
- } LsmSvgRealStyle;
469
-
470
- static const LsmSvgStyle *
471
- lsm_svg_get_default_style (void)
472
- {
473
- static LsmSvgStyle *style = NULL;
474
- LsmPropertyManager *property_manager = lsm_svg_get_property_manager ();
475
-
476
- if (style != NULL)
477
- return style;
478
-
479
- style = lsm_svg_style_new ();
480
- style->font_size_px = 0.0;
481
-
482
- lsm_property_manager_init_default_style (property_manager, style);
483
-
484
- return style;
485
- }
486
-
487
- LsmSvgStyle *
488
- lsm_svg_style_new (void)
489
- {
490
- LsmSvgRealStyle *style;
491
-
492
- style = g_slice_new0 (LsmSvgRealStyle);
493
- style->ref_count = 1;
494
-
495
- return (LsmSvgStyle *) style;
496
- }
497
-
498
- LsmSvgStyle *
499
- lsm_svg_style_ref (LsmSvgStyle *style)
500
- {
501
- LsmSvgRealStyle *real_style = (LsmSvgRealStyle *) style;
502
-
503
- g_return_val_if_fail (real_style != NULL, style);
504
- g_return_val_if_fail (g_atomic_int_get (&real_style->ref_count) > 0, style);
505
- g_atomic_int_inc (&real_style->ref_count);
506
-
507
- return style;
508
- }
509
-
510
- void
511
- lsm_svg_style_unref (LsmSvgStyle *style)
512
- {
513
- LsmSvgRealStyle *real_style = (LsmSvgRealStyle *) style;
514
-
515
- g_return_if_fail (g_atomic_int_get (&real_style->ref_count) > 0);
516
- if (g_atomic_int_dec_and_test (&real_style->ref_count))
517
- g_slice_free (LsmSvgRealStyle, real_style);
518
- }
519
-
520
- LsmSvgStyle *
521
- lsm_svg_style_new_inherited (const LsmSvgStyle *parent_style, LsmPropertyBag *property_bag)
522
- {
523
- LsmPropertyManager *property_manager = lsm_svg_get_property_manager ();
524
- LsmSvgRealStyle *real_style;
525
- LsmSvgStyle *style;
526
- const LsmSvgStyle *default_style;
527
-
528
- default_style = lsm_svg_get_default_style ();
529
-
530
- real_style = g_slice_new (LsmSvgRealStyle);
531
- real_style->ref_count = 1;
532
-
533
- style = &real_style->base;
534
-
535
- if (parent_style != NULL) {
536
- memcpy (style, default_style, offsetof (LsmSvgStyle, clip_rule));
537
- memcpy (&style->clip_rule, &parent_style->clip_rule,
538
- sizeof (LsmSvgStyle) - offsetof (LsmSvgStyle, clip_rule));
539
- } else {
540
- memcpy (style, default_style, sizeof (LsmSvgStyle));
541
- }
542
-
543
- lsm_property_manager_apply_property_bag (property_manager, property_bag, style, parent_style);
544
-
545
- return style;
546
- }
547
-
548
- LsmSvgStyle *
549
- lsm_svg_style_duplicate (const LsmSvgStyle *origin)
550
- {
551
- LsmSvgStyle *style;
552
-
553
- style = g_new (LsmSvgStyle, 1);
554
-
555
- memcpy (style, origin, sizeof (LsmSvgStyle));
556
-
557
- return style;
558
- }