mathematical 0.1.0 → 0.1.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 +4 -4
- data/ext/mathematical/extconf.rb +14 -0
- data/ext/mathematical/itex2MML.h +63 -0
- data/ext/mathematical/lasemrender.c +257 -0
- data/ext/mathematical/lex.yy.c +6548 -0
- data/ext/mathematical/lsm.c +31 -0
- data/ext/mathematical/lsm.h +39 -0
- data/ext/mathematical/lsmattributes.c +279 -0
- data/ext/mathematical/lsmattributes.h +75 -0
- data/ext/mathematical/lsmcairo.c +598 -0
- data/ext/mathematical/lsmcairo.h +51 -0
- data/ext/mathematical/lsmdebug.c +183 -0
- data/ext/mathematical/lsmdebug.h +73 -0
- data/ext/mathematical/lsmdom.h +43 -0
- data/ext/mathematical/lsmdomcharacterdata.c +114 -0
- data/ext/mathematical/lsmdomcharacterdata.h +59 -0
- data/ext/mathematical/lsmdomdocument.c +255 -0
- data/ext/mathematical/lsmdomdocument.h +75 -0
- data/ext/mathematical/lsmdomdocumentfragment.c +81 -0
- data/ext/mathematical/lsmdomdocumentfragment.h +55 -0
- data/ext/mathematical/lsmdomelement.c +148 -0
- data/ext/mathematical/lsmdomelement.h +62 -0
- data/ext/mathematical/lsmdomentities.c +2166 -0
- data/ext/mathematical/lsmdomentities.h +35 -0
- data/ext/mathematical/lsmdomenumtypes.c +99 -0
- data/ext/mathematical/lsmdomenumtypes.h +26 -0
- data/ext/mathematical/lsmdomimplementation.c +82 -0
- data/ext/mathematical/lsmdomimplementation.h +41 -0
- data/ext/mathematical/lsmdomnamednodemap.c +118 -0
- data/ext/mathematical/lsmdomnamednodemap.h +64 -0
- data/ext/mathematical/lsmdomnode.c +737 -0
- data/ext/mathematical/lsmdomnode.h +122 -0
- data/ext/mathematical/lsmdomnodelist.c +70 -0
- data/ext/mathematical/lsmdomnodelist.h +58 -0
- data/ext/mathematical/lsmdomparser.c +461 -0
- data/ext/mathematical/lsmdomparser.h +54 -0
- data/ext/mathematical/lsmdomtext.c +82 -0
- data/ext/mathematical/lsmdomtext.h +55 -0
- data/ext/mathematical/lsmdomtypes.h +44 -0
- data/ext/mathematical/lsmdomview.c +422 -0
- data/ext/mathematical/lsmdomview.h +94 -0
- data/ext/mathematical/lsmitex.c +76 -0
- data/ext/mathematical/lsmitex.h +36 -0
- data/ext/mathematical/lsmmathml.h +66 -0
- data/ext/mathematical/lsmmathmlactionelement.c +93 -0
- data/ext/mathematical/lsmmathmlactionelement.h +57 -0
- data/ext/mathematical/lsmmathmlaligngroupelement.c +102 -0
- data/ext/mathematical/lsmmathmlaligngroupelement.h +56 -0
- data/ext/mathematical/lsmmathmlalignmarkelement.c +102 -0
- data/ext/mathematical/lsmmathmlalignmarkelement.h +56 -0
- data/ext/mathematical/lsmmathmlattributes.c +197 -0
- data/ext/mathematical/lsmmathmlattributes.h +126 -0
- data/ext/mathematical/lsmmathmldocument.c +304 -0
- data/ext/mathematical/lsmmathmldocument.h +61 -0
- data/ext/mathematical/lsmmathmlelement.c +491 -0
- data/ext/mathematical/lsmmathmlelement.h +107 -0
- data/ext/mathematical/lsmmathmlenums.c +429 -0
- data/ext/mathematical/lsmmathmlenums.h +182 -0
- data/ext/mathematical/lsmmathmlenumtypes.c +666 -0
- data/ext/mathematical/lsmmathmlenumtypes.h +90 -0
- data/ext/mathematical/lsmmathmlerrorelement.c +58 -0
- data/ext/mathematical/lsmmathmlerrorelement.h +56 -0
- data/ext/mathematical/lsmmathmlfencedelement.c +178 -0
- data/ext/mathematical/lsmmathmlfencedelement.h +65 -0
- data/ext/mathematical/lsmmathmlfractionelement.c +253 -0
- data/ext/mathematical/lsmmathmlfractionelement.h +62 -0
- data/ext/mathematical/lsmmathmlglyphtableams.c +597 -0
- data/ext/mathematical/lsmmathmlglyphtableams.h +45 -0
- data/ext/mathematical/lsmmathmlitexelement.c +187 -0
- data/ext/mathematical/lsmmathmlitexelement.h +60 -0
- data/ext/mathematical/lsmmathmllayoututils.c +191 -0
- data/ext/mathematical/lsmmathmllayoututils.h +58 -0
- data/ext/mathematical/lsmmathmlmathelement.c +204 -0
- data/ext/mathematical/lsmmathmlmathelement.h +81 -0
- data/ext/mathematical/lsmmathmloperatordictionary.c +3332 -0
- data/ext/mathematical/lsmmathmloperatordictionary.h +54 -0
- data/ext/mathematical/lsmmathmloperatorelement.c +307 -0
- data/ext/mathematical/lsmmathmloperatorelement.h +73 -0
- data/ext/mathematical/lsmmathmlpaddedelement.c +58 -0
- data/ext/mathematical/lsmmathmlpaddedelement.h +56 -0
- data/ext/mathematical/lsmmathmlphantomelement.c +71 -0
- data/ext/mathematical/lsmmathmlphantomelement.h +56 -0
- data/ext/mathematical/lsmmathmlpresentationcontainer.c +43 -0
- data/ext/mathematical/lsmmathmlpresentationcontainer.h +54 -0
- data/ext/mathematical/lsmmathmlpresentationtoken.c +303 -0
- data/ext/mathematical/lsmmathmlpresentationtoken.h +83 -0
- data/ext/mathematical/lsmmathmlradicalelement.c +266 -0
- data/ext/mathematical/lsmmathmlradicalelement.h +71 -0
- data/ext/mathematical/lsmmathmlrowelement.c +58 -0
- data/ext/mathematical/lsmmathmlrowelement.h +56 -0
- data/ext/mathematical/lsmmathmlscriptelement.c +282 -0
- data/ext/mathematical/lsmmathmlscriptelement.h +78 -0
- data/ext/mathematical/lsmmathmlsemanticselement.c +84 -0
- data/ext/mathematical/lsmmathmlsemanticselement.h +56 -0
- data/ext/mathematical/lsmmathmlspaceelement.c +142 -0
- data/ext/mathematical/lsmmathmlspaceelement.h +60 -0
- data/ext/mathematical/lsmmathmlstringelement.c +123 -0
- data/ext/mathematical/lsmmathmlstringelement.h +58 -0
- data/ext/mathematical/lsmmathmlstyle.c +130 -0
- data/ext/mathematical/lsmmathmlstyle.h +81 -0
- data/ext/mathematical/lsmmathmlstyleelement.c +307 -0
- data/ext/mathematical/lsmmathmlstyleelement.h +87 -0
- data/ext/mathematical/lsmmathmltablecellelement.c +122 -0
- data/ext/mathematical/lsmmathmltablecellelement.h +62 -0
- data/ext/mathematical/lsmmathmltableelement.c +545 -0
- data/ext/mathematical/lsmmathmltableelement.h +78 -0
- data/ext/mathematical/lsmmathmltablerowelement.c +120 -0
- data/ext/mathematical/lsmmathmltablerowelement.h +64 -0
- data/ext/mathematical/lsmmathmltraits.c +819 -0
- data/ext/mathematical/lsmmathmltraits.h +119 -0
- data/ext/mathematical/lsmmathmltypes.h +66 -0
- data/ext/mathematical/lsmmathmlunderoverelement.c +485 -0
- data/ext/mathematical/lsmmathmlunderoverelement.h +82 -0
- data/ext/mathematical/lsmmathmlutils.c +170 -0
- data/ext/mathematical/lsmmathmlutils.h +50 -0
- data/ext/mathematical/lsmmathmlview.c +1048 -0
- data/ext/mathematical/lsmmathmlview.h +164 -0
- data/ext/mathematical/lsmproperties.c +418 -0
- data/ext/mathematical/lsmproperties.h +85 -0
- data/ext/mathematical/lsmstr.c +231 -0
- data/ext/mathematical/lsmstr.h +114 -0
- data/ext/mathematical/lsmsvg.h +67 -0
- data/ext/mathematical/lsmsvgaelement.c +73 -0
- data/ext/mathematical/lsmsvgaelement.h +55 -0
- data/ext/mathematical/lsmsvgattributes.h +118 -0
- data/ext/mathematical/lsmsvgcircleelement.c +153 -0
- data/ext/mathematical/lsmsvgcircleelement.h +59 -0
- data/ext/mathematical/lsmsvgclippathelement.c +134 -0
- data/ext/mathematical/lsmsvgclippathelement.h +59 -0
- data/ext/mathematical/lsmsvgcolors.c +212 -0
- data/ext/mathematical/lsmsvgcolors.h +39 -0
- data/ext/mathematical/lsmsvgdefselement.c +74 -0
- data/ext/mathematical/lsmsvgdefselement.h +55 -0
- data/ext/mathematical/lsmsvgdocument.c +288 -0
- data/ext/mathematical/lsmsvgdocument.h +64 -0
- data/ext/mathematical/lsmsvgelement.c +373 -0
- data/ext/mathematical/lsmsvgelement.h +81 -0
- data/ext/mathematical/lsmsvgellipseelement.c +158 -0
- data/ext/mathematical/lsmsvgellipseelement.h +60 -0
- data/ext/mathematical/lsmsvgenums.c +544 -0
- data/ext/mathematical/lsmsvgenums.h +357 -0
- data/ext/mathematical/lsmsvgenumtypes.c +1083 -0
- data/ext/mathematical/lsmsvgenumtypes.h +111 -0
- data/ext/mathematical/lsmsvgfilterblend.c +105 -0
- data/ext/mathematical/lsmsvgfilterblend.h +58 -0
- data/ext/mathematical/lsmsvgfiltercomposite.c +109 -0
- data/ext/mathematical/lsmsvgfiltercomposite.h +58 -0
- data/ext/mathematical/lsmsvgfilterelement.c +266 -0
- data/ext/mathematical/lsmsvgfilterelement.h +66 -0
- data/ext/mathematical/lsmsvgfilterflood.c +86 -0
- data/ext/mathematical/lsmsvgfilterflood.h +55 -0
- data/ext/mathematical/lsmsvgfiltergaussianblur.c +114 -0
- data/ext/mathematical/lsmsvgfiltergaussianblur.h +57 -0
- data/ext/mathematical/lsmsvgfiltermerge.c +98 -0
- data/ext/mathematical/lsmsvgfiltermerge.h +55 -0
- data/ext/mathematical/lsmsvgfiltermergenode.c +87 -0
- data/ext/mathematical/lsmsvgfiltermergenode.h +57 -0
- data/ext/mathematical/lsmsvgfilteroffset.c +112 -0
- data/ext/mathematical/lsmsvgfilteroffset.h +58 -0
- data/ext/mathematical/lsmsvgfilterprimitive.c +168 -0
- data/ext/mathematical/lsmsvgfilterprimitive.h +66 -0
- data/ext/mathematical/lsmsvgfilterspecularlighting.c +127 -0
- data/ext/mathematical/lsmsvgfilterspecularlighting.h +60 -0
- data/ext/mathematical/lsmsvgfiltersurface.c +455 -0
- data/ext/mathematical/lsmsvgfiltersurface.h +66 -0
- data/ext/mathematical/lsmsvgfiltertile.c +102 -0
- data/ext/mathematical/lsmsvgfiltertile.h +57 -0
- data/ext/mathematical/lsmsvggelement.c +73 -0
- data/ext/mathematical/lsmsvggelement.h +55 -0
- data/ext/mathematical/lsmsvggradientelement.c +151 -0
- data/ext/mathematical/lsmsvggradientelement.h +68 -0
- data/ext/mathematical/lsmsvgimageelement.c +261 -0
- data/ext/mathematical/lsmsvgimageelement.h +67 -0
- data/ext/mathematical/lsmsvglength.c +152 -0
- data/ext/mathematical/lsmsvglength.h +65 -0
- data/ext/mathematical/lsmsvglineargradientelement.c +271 -0
- data/ext/mathematical/lsmsvglineargradientelement.h +60 -0
- data/ext/mathematical/lsmsvglineelement.c +153 -0
- data/ext/mathematical/lsmsvglineelement.h +60 -0
- data/ext/mathematical/lsmsvgmarkerelement.c +266 -0
- data/ext/mathematical/lsmsvgmarkerelement.h +74 -0
- data/ext/mathematical/lsmsvgmaskelement.c +232 -0
- data/ext/mathematical/lsmsvgmaskelement.h +64 -0
- data/ext/mathematical/lsmsvgmatrix.c +205 -0
- data/ext/mathematical/lsmsvgmatrix.h +59 -0
- data/ext/mathematical/lsmsvgpathelement.c +115 -0
- data/ext/mathematical/lsmsvgpathelement.h +59 -0
- data/ext/mathematical/lsmsvgpatternelement.c +398 -0
- data/ext/mathematical/lsmsvgpatternelement.h +69 -0
- data/ext/mathematical/lsmsvgpolygonelement.c +106 -0
- data/ext/mathematical/lsmsvgpolygonelement.h +57 -0
- data/ext/mathematical/lsmsvgpolylineelement.c +106 -0
- data/ext/mathematical/lsmsvgpolylineelement.h +57 -0
- data/ext/mathematical/lsmsvgradialgradientelement.c +323 -0
- data/ext/mathematical/lsmsvgradialgradientelement.h +61 -0
- data/ext/mathematical/lsmsvgrectelement.c +184 -0
- data/ext/mathematical/lsmsvgrectelement.h +62 -0
- data/ext/mathematical/lsmsvgstopelement.c +106 -0
- data/ext/mathematical/lsmsvgstopelement.h +57 -0
- data/ext/mathematical/lsmsvgstyle.c +560 -0
- data/ext/mathematical/lsmsvgstyle.h +217 -0
- data/ext/mathematical/lsmsvgsvgelement.c +260 -0
- data/ext/mathematical/lsmsvgsvgelement.h +71 -0
- data/ext/mathematical/lsmsvgswitchelement.c +103 -0
- data/ext/mathematical/lsmsvgswitchelement.h +55 -0
- data/ext/mathematical/lsmsvgsymbolelement.c +74 -0
- data/ext/mathematical/lsmsvgsymbolelement.h +55 -0
- data/ext/mathematical/lsmsvgtextelement.c +203 -0
- data/ext/mathematical/lsmsvgtextelement.h +60 -0
- data/ext/mathematical/lsmsvgtraits.c +1232 -0
- data/ext/mathematical/lsmsvgtraits.h +104 -0
- data/ext/mathematical/lsmsvgtransformable.c +106 -0
- data/ext/mathematical/lsmsvgtransformable.h +54 -0
- data/ext/mathematical/lsmsvgtspanelement.c +174 -0
- data/ext/mathematical/lsmsvgtspanelement.h +60 -0
- data/ext/mathematical/lsmsvgtypes.h +77 -0
- data/ext/mathematical/lsmsvguseelement.c +237 -0
- data/ext/mathematical/lsmsvguseelement.h +69 -0
- data/ext/mathematical/lsmsvgview.c +2583 -0
- data/ext/mathematical/lsmsvgview.h +179 -0
- data/ext/mathematical/lsmtraits.c +119 -0
- data/ext/mathematical/lsmtraits.h +49 -0
- data/ext/mathematical/lsmtypes.h +36 -0
- data/ext/mathematical/lsmutils.c +54 -0
- data/ext/mathematical/lsmutils.h +56 -0
- data/ext/mathematical/mathematical.c +145 -0
- data/ext/mathematical/y.tab.c +6179 -0
- data/ext/mathematical/y.tab.h +389 -0
- data/lib/mathematical/version.rb +1 -1
- data/mathematical.gemspec +8 -6
- data/test/mathematical/basic_test.rb +9 -0
- data/test/mathematical/fixtures/after/brackets_display.html +1 -0
- data/test/mathematical/fixtures/after/compliance_accents.html +17 -0
- data/test/mathematical/fixtures/after/compliance_arrows.html +71 -0
- data/test/mathematical/fixtures/after/compliance_colors.html +4 -0
- data/test/mathematical/fixtures/after/compliance_greek_letters.html +42 -0
- data/test/mathematical/fixtures/after/compliance_large_math.html +19 -0
- data/test/mathematical/fixtures/after/compliance_log_symbols.html +34 -0
- data/test/mathematical/fixtures/after/compliance_operators.html +262 -0
- data/test/mathematical/fixtures/after/dollar_sign_inline.html +1 -0
- data/test/mathematical/fixtures/after/equation_display.html +1 -0
- data/test/mathematical/fixtures/after/multiple_dollar_inline.html +1 -0
- data/test/mathematical/fixtures/after/parens_inline.html +1 -0
- data/test/mathematical/fixtures/before/brackets_display.text +1 -0
- data/test/mathematical/fixtures/before/compliance_accents.text +17 -0
- data/test/mathematical/fixtures/before/compliance_arrows.text +71 -0
- data/test/mathematical/fixtures/before/compliance_colors.text +4 -0
- data/test/mathematical/fixtures/before/compliance_greek_letters.text +42 -0
- data/test/mathematical/fixtures/before/compliance_large_math.text +19 -0
- data/test/mathematical/fixtures/before/compliance_log_symbols.text +34 -0
- data/test/mathematical/fixtures/before/compliance_operators.text +262 -0
- data/test/mathematical/fixtures/before/dollar_sign_inline.text +1 -0
- data/test/mathematical/fixtures/before/equation_display.text +1 -0
- data/test/mathematical/fixtures/before/multiple_dollar_inline.text +1 -0
- data/test/mathematical/fixtures/before/parens_inline.text +1 -0
- data/test/mathematical/fixtures/performance/big_file.text +1767 -0
- data/test/mathematical/fixtures_test.rb +45 -0
- data/test/mathematical/maliciousness_test.rb +45 -0
- data/test/mathematical/performance_test.rb +15 -0
- data/test/test_helper.rb +5 -0
- metadata +301 -14
- data/lib/mathematical.bundle +0 -0
- data/lib/mathematical/mathematical.bundle +0 -0
@@ -0,0 +1,560 @@
|
|
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
|
+
#if 0 /* Unused code - remove? */
|
549
|
+
LsmSvgStyle *
|
550
|
+
lsm_svg_style_duplicate (const LsmSvgStyle *origin)
|
551
|
+
{
|
552
|
+
LsmSvgStyle *style;
|
553
|
+
|
554
|
+
style = g_new (LsmSvgStyle, 1);
|
555
|
+
|
556
|
+
memcpy (style, origin, sizeof (LsmSvgStyle));
|
557
|
+
|
558
|
+
return style;
|
559
|
+
}
|
560
|
+
#endif /* 0 */
|