1 #define __SP_ATTRIBUTES_C__
3 /** \file
4 * Lookup dictionary for attributes/properties.
5 */
6 /*
7 * Author:
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 *
10 * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
11 * Copyright (C) 2002 Lauris Kaplinski
12 *
13 * Released under GNU GPL, read the file 'COPYING' for more information
14 */
16 #ifdef HAVE_CONFIG_H
17 # include "config.h"
18 #endif
20 #include <glib.h> // g_assert()
21 #include <glib/ghash.h>
22 #include "attributes.h"
24 typedef struct {
25 gint code;
26 gchar const *name;
27 } SPStyleProp;
29 static SPStyleProp const props[] = {
30 {SP_ATTR_INVALID, NULL},
31 /* SPObject */
32 {SP_ATTR_ID, "id"},
33 {SP_ATTR_INKSCAPE_COLLECT, "inkscape:collect"},
34 {SP_ATTR_INKSCAPE_LABEL, "inkscape:label"},
35 /* SPItem */
36 {SP_ATTR_TRANSFORM, "transform"},
37 {SP_ATTR_SODIPODI_INSENSITIVE, "sodipodi:insensitive"},
38 {SP_ATTR_SODIPODI_NONPRINTABLE, "sodipodi:nonprintable"},
39 {SP_ATTR_CONNECTOR_AVOID, "inkscape:connector-avoid"},
40 {SP_ATTR_STYLE, "style"},
41 {SP_ATTR_TRANSFORM_CENTER_X, "inkscape:transform-center-x"},
42 {SP_ATTR_TRANSFORM_CENTER_Y, "inkscape:transform-center-y"},
43 {SP_ATTR_INKSCAPE_PATH_EFFECT, "inkscape:path-effect"},
44 /* SPAnchor */
45 {SP_ATTR_XLINK_HREF, "xlink:href"},
46 {SP_ATTR_XLINK_TYPE, "xlink:type"},
47 {SP_ATTR_XLINK_ROLE, "xlink:role"},
48 {SP_ATTR_XLINK_ARCROLE, "xlink:arcrole"},
49 {SP_ATTR_XLINK_TITLE, "xlink:title"},
50 {SP_ATTR_XLINK_SHOW, "xlink:show"},
51 {SP_ATTR_XLINK_ACTUATE, "xlink:actuate"},
52 {SP_ATTR_TARGET, "target"},
53 {SP_ATTR_INKSCAPE_GROUPMODE, "inkscape:groupmode"},
54 /* SPRoot */
55 {SP_ATTR_VERSION, "version"},
56 {SP_ATTR_WIDTH, "width"},
57 {SP_ATTR_HEIGHT, "height"},
58 {SP_ATTR_VIEWBOX, "viewBox"},
59 {SP_ATTR_PRESERVEASPECTRATIO, "preserveAspectRatio"},
60 {SP_ATTR_SODIPODI_VERSION, "sodipodi:version"},
61 {SP_ATTR_INKSCAPE_VERSION, "inkscape:version"},
62 {SP_ATTR_ONLOAD, "onload"},
63 /* SPNamedView */
64 {SP_ATTR_VIEWONLY, "viewonly"},
65 {SP_ATTR_SHOWGUIDES, "showguides"},
66 {SP_ATTR_SHOWGRIDS, "showgrid"},
67 {SP_ATTR_GRIDTOLERANCE, "gridtolerance"},
68 {SP_ATTR_GUIDETOLERANCE, "guidetolerance"},
69 {SP_ATTR_OBJECTTOLERANCE, "objecttolerance"},
70 {SP_ATTR_GUIDECOLOR, "guidecolor"},
71 {SP_ATTR_GUIDEOPACITY, "guideopacity"},
72 {SP_ATTR_GUIDEHICOLOR, "guidehicolor"},
73 {SP_ATTR_GUIDEHIOPACITY, "guidehiopacity"},
74 {SP_ATTR_SHOWBORDER, "showborder"},
75 {SP_ATTR_SHOWPAGESHADOW, "inkscape:showpageshadow"},
76 {SP_ATTR_BORDERLAYER, "borderlayer"},
77 {SP_ATTR_BORDERCOLOR, "bordercolor"},
78 {SP_ATTR_BORDEROPACITY, "borderopacity"},
79 {SP_ATTR_PAGECOLOR, "pagecolor"},
80 {SP_ATTR_INKSCAPE_PAGEOPACITY, "inkscape:pageopacity"},
81 {SP_ATTR_INKSCAPE_PAGESHADOW, "inkscape:pageshadow"},
82 {SP_ATTR_INKSCAPE_ZOOM, "inkscape:zoom"},
83 {SP_ATTR_INKSCAPE_CX, "inkscape:cx"},
84 {SP_ATTR_INKSCAPE_CY, "inkscape:cy"},
85 {SP_ATTR_INKSCAPE_WINDOW_WIDTH, "inkscape:window-width"},
86 {SP_ATTR_INKSCAPE_WINDOW_HEIGHT, "inkscape:window-height"},
87 {SP_ATTR_INKSCAPE_WINDOW_X, "inkscape:window-x"},
88 {SP_ATTR_INKSCAPE_WINDOW_Y, "inkscape:window-y"},
89 {SP_ATTR_INKSCAPE_SNAP_GLOBAL, "inkscape:snap-global"},
90 {SP_ATTR_INKSCAPE_SNAP_BBOX, "inkscape:snap-bbox"},
91 {SP_ATTR_INKSCAPE_SNAP_NODES, "inkscape:snap-nodes"},
92 {SP_ATTR_INKSCAPE_SNAP_GUIDE, "inkscape:snap-guide"},
93 {SP_ATTR_INKSCAPE_SNAP_CENTER, "inkscape:snap-center"},
94 {SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES, "inkscape:snap-smooth-nodes"},
95 {SP_ATTR_INKSCAPE_SNAP_LINE_MIDPOINTS, "inkscape:snap-midpoints"},
96 {SP_ATTR_INKSCAPE_SNAP_OBJECT_MIDPOINTS, "inkscape:snap-object-midpoints"},
97 {SP_ATTR_INKSCAPE_SNAP_BBOX_EDGE_MIDPOINTS, "inkscape:snap-bbox-edge-midpoints"},
98 {SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS, "inkscape:snap-bbox-midpoints"},
99 {SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE, "inkscape:snap-intersection-grid-guide"},
100 {SP_ATTR_INKSCAPE_SNAP_INTERS_PATHS, "inkscape:snap-intersection-paths"},
101 {SP_ATTR_INKSCAPE_OBJECT_PATHS, "inkscape:object-paths"},
102 {SP_ATTR_INKSCAPE_OBJECT_NODES, "inkscape:object-nodes"},
103 {SP_ATTR_INKSCAPE_BBOX_PATHS, "inkscape:bbox-paths"},
104 {SP_ATTR_INKSCAPE_BBOX_NODES, "inkscape:bbox-nodes"},
105 {SP_ATTR_INKSCAPE_SNAP_PAGE, "inkscape:snap-page"},
106 {SP_ATTR_INKSCAPE_CURRENT_LAYER, "inkscape:current-layer"},
107 {SP_ATTR_INKSCAPE_DOCUMENT_UNITS, "inkscape:document-units"},
108 {SP_ATTR_INKSCAPE_CONNECTOR_SPACING, "inkscape:connector-spacing"},
109 /* SPColorProfile */
110 {SP_ATTR_LOCAL, "local"},
111 {SP_ATTR_NAME, "name"},
112 {SP_ATTR_RENDERING_INTENT, "rendering-intent"},
113 /* SPGuide */
114 {SP_ATTR_ORIENTATION, "orientation"},
115 {SP_ATTR_POSITION, "position"},
116 /* SPImage */
117 {SP_ATTR_X, "x"},
118 {SP_ATTR_Y, "y"},
119 /* SPPath */
120 {SP_ATTR_D, "d"},
121 {SP_ATTR_INKSCAPE_ORIGINAL_D, "inkscape:original-d"},
122 /* (Note: XML representation of connectors may change in future.) */
123 {SP_ATTR_CONNECTOR_TYPE, "inkscape:connector-type"},
124 {SP_ATTR_CONNECTION_START, "inkscape:connection-start"},
125 {SP_ATTR_CONNECTION_END, "inkscape:connection-end"},
126 /* SPRect */
127 {SP_ATTR_RX, "rx"},
128 {SP_ATTR_RY, "ry"},
129 /* Box3D */
130 {SP_ATTR_INKSCAPE_BOX3D_PERSPECTIVE_ID, "inkscape:perspectiveID"},
131 {SP_ATTR_INKSCAPE_BOX3D_CORNER0, "inkscape:corner0"},
132 {SP_ATTR_INKSCAPE_BOX3D_CORNER7, "inkscape:corner7"},
133 /* Box3DSide */
134 {SP_ATTR_INKSCAPE_BOX3D_SIDE_TYPE, "inkscape:box3dsidetype"}, // XYfront, etc.
135 /* Persp3D */
136 {SP_ATTR_INKSCAPE_PERSP3D, "inkscape:persp3d"},
137 {SP_ATTR_INKSCAPE_PERSP3D_VP_X, "inkscape:vp_x"},
138 {SP_ATTR_INKSCAPE_PERSP3D_VP_Y, "inkscape:vp_y"},
139 {SP_ATTR_INKSCAPE_PERSP3D_VP_Z, "inkscape:vp_z"},
140 {SP_ATTR_INKSCAPE_PERSP3D_ORIGIN, "inkscape:persp3d-origin"},
141 /* SPEllipse */
142 {SP_ATTR_R, "r"},
143 {SP_ATTR_CX, "cx"},
144 {SP_ATTR_CY, "cy"},
145 {SP_ATTR_SODIPODI_CX, "sodipodi:cx"},
146 {SP_ATTR_SODIPODI_CY, "sodipodi:cy"},
147 {SP_ATTR_SODIPODI_RX, "sodipodi:rx"},
148 {SP_ATTR_SODIPODI_RY, "sodipodi:ry"},
149 {SP_ATTR_SODIPODI_START, "sodipodi:start"},
150 {SP_ATTR_SODIPODI_END, "sodipodi:end"},
151 {SP_ATTR_SODIPODI_OPEN, "sodipodi:open"},
152 /* SPStar */
153 {SP_ATTR_SODIPODI_SIDES, "sodipodi:sides"},
154 {SP_ATTR_SODIPODI_R1, "sodipodi:r1"},
155 {SP_ATTR_SODIPODI_R2, "sodipodi:r2"},
156 {SP_ATTR_SODIPODI_ARG1, "sodipodi:arg1"},
157 {SP_ATTR_SODIPODI_ARG2, "sodipodi:arg2"},
158 {SP_ATTR_INKSCAPE_FLATSIDED, "inkscape:flatsided"},
159 {SP_ATTR_INKSCAPE_ROUNDED, "inkscape:rounded"},
160 {SP_ATTR_INKSCAPE_RANDOMIZED, "inkscape:randomized"},
161 /* SPSpiral */
162 {SP_ATTR_SODIPODI_EXPANSION, "sodipodi:expansion"},
163 {SP_ATTR_SODIPODI_REVOLUTION, "sodipodi:revolution"},
164 {SP_ATTR_SODIPODI_RADIUS, "sodipodi:radius"},
165 {SP_ATTR_SODIPODI_ARGUMENT, "sodipodi:argument"},
166 {SP_ATTR_SODIPODI_T0, "sodipodi:t0"},
167 /* SPOffset */
168 {SP_ATTR_SODIPODI_ORIGINAL, "sodipodi:original"},
169 {SP_ATTR_INKSCAPE_ORIGINAL, "inkscape:original"},
170 {SP_ATTR_INKSCAPE_HREF, "inkscape:href"},
171 {SP_ATTR_INKSCAPE_RADIUS, "inkscape:radius"},
172 /* SPLine */
173 {SP_ATTR_X1, "x1"},
174 {SP_ATTR_Y1, "y1"},
175 {SP_ATTR_X2, "x2"},
176 {SP_ATTR_Y2, "y2"},
177 /* SPPolyline */
178 {SP_ATTR_POINTS, "points"},
179 /* SPTSpan */
180 {SP_ATTR_DX, "dx"},
181 {SP_ATTR_DY, "dy"},
182 {SP_ATTR_ROTATE, "rotate"},
183 {SP_ATTR_SODIPODI_ROLE, "sodipodi:role"},
184 /* SPText */
185 {SP_ATTR_SODIPODI_LINESPACING, "sodipodi:linespacing"},
186 /* SPTextPath */
187 {SP_ATTR_STARTOFFSET, "startOffset"},
188 /* SPStop */
189 {SP_ATTR_OFFSET, "offset"},
190 /* SPFilter */
191 {SP_ATTR_FILTERUNITS, "filterUnits"},
192 {SP_ATTR_PRIMITIVEUNITS, "primitiveUnits"},
193 {SP_ATTR_FILTERRES, "filterRes"},
194 /* Filter primitives common */
195 {SP_ATTR_IN, "in"},
196 {SP_ATTR_RESULT, "result"},
197 /*feBlend*/
198 {SP_ATTR_MODE, "mode"},
199 {SP_ATTR_IN2, "in2"},
200 /*feColorMatrix*/
201 {SP_ATTR_TYPE, "type"},
202 {SP_ATTR_VALUES, "values"},
203 /*feComponentTransfer*/
204 //{SP_ATTR_TYPE, "type"},
205 {SP_ATTR_TABLEVALUES, "tableValues"},
206 {SP_ATTR_SLOPE, "slope"},
207 {SP_ATTR_INTERCEPT, "intercept"},
208 {SP_ATTR_AMPLITUDE, "amplitude"},
209 {SP_ATTR_EXPONENT, "exponent"},
210 //{SP_ATTR_OFFSET, "offset"},
211 /*feComposite*/
212 {SP_ATTR_OPERATOR, "operator"},
213 {SP_ATTR_K1, "k1"},
214 {SP_ATTR_K2, "k2"},
215 {SP_ATTR_K3, "k3"},
216 {SP_ATTR_K4, "k4"},
217 //{SP_ATTR_IN2, "in2"},
218 /*feConvolveMatrix*/
219 {SP_ATTR_ORDER, "order"},
220 {SP_ATTR_KERNELMATRIX, "kernelMatrix"},
221 {SP_ATTR_DIVISOR, "divisor"},
222 {SP_ATTR_BIAS, "bias"},
223 {SP_ATTR_TARGETX, "targetX"},
224 {SP_ATTR_TARGETY, "targetY"},
225 {SP_ATTR_EDGEMODE, "edgeMode"},
226 {SP_ATTR_KERNELUNITLENGTH, "kernelUnitLength"},
227 {SP_ATTR_PRESERVEALPHA, "preserveAlpha"},
228 /*feDiffuseLighting*/
229 {SP_ATTR_SURFACESCALE, "surfaceScale"},
230 {SP_ATTR_DIFFUSECONSTANT, "diffuseConstant"},
231 //{SP_ATTR_KERNELUNITLENGTH, "kernelUnitLength"},
232 /*feDisplacementMap*/
233 {SP_ATTR_SCALE, "scale"},
234 {SP_ATTR_XCHANNELSELECTOR, "xChannelSelector"},
235 {SP_ATTR_YCHANNELSELECTOR, "yChannelSelector"},
236 //{SP_ATTR_IN2, "in2"},
237 /*feDistantLight*/
238 {SP_ATTR_AZIMUTH, "azimuth"},
239 {SP_ATTR_ELEVATION, "elevation"},
240 /*fePointLight*/
241 {SP_ATTR_Z, "z"},
242 /*feSpotLight*/
243 {SP_ATTR_POINTSATX, "pointsAtX"},
244 {SP_ATTR_POINTSATY, "pointsAtY"},
245 {SP_ATTR_POINTSATZ, "pointsAtZ"},
246 {SP_ATTR_LIMITINGCONEANGLE, "limitingConeAngle"},
247 /*feFlood*/
248 {SP_ATTR_FLOODCOLOR, "flood-color"},
249 {SP_ATTR_FLOODOPACITY, "flood-opacity"},
250 /* SPGaussianBlur */
251 {SP_ATTR_STDDEVIATION, "stdDeviation"},
252 /*feImage*/
253 /*feMerge*/
254 /*feMorphology*/
255 //{SP_ATTR_OPERATOR, "operator"},
256 {SP_ATTR_RADIUS, "radius"},
257 /*feOffset*/
258 //{SP_ATTR_DX, "dx"},
259 //{SP_ATTR_DY, "dy"},
260 /*feSpecularLighting*/
261 {SP_ATTR_SPECULARCONSTANT, "specularConstant"},
262 {SP_ATTR_SPECULAREXPONENT, "specularExponent"},
263 /*feTile*/
264 /*feTurbulence*/
265 {SP_ATTR_BASEFREQUENCY, "baseFrequency"},
266 {SP_ATTR_NUMOCTAVES, "numOctaves"},
267 {SP_ATTR_SEED, "seed"},
268 {SP_ATTR_STITCHTILES, "stitchTiles"},
269 //{SP_ATTR_TYPE, "type"},
270 /* SPGradient */
271 {SP_ATTR_GRADIENTUNITS, "gradientUnits"},
272 {SP_ATTR_GRADIENTTRANSFORM, "gradientTransform"},
273 {SP_ATTR_SPREADMETHOD, "spreadMethod"},
274 /* SPRadialGradient */
275 {SP_ATTR_FX, "fx"},
276 {SP_ATTR_FY, "fy"},
277 /* SPPattern */
278 {SP_ATTR_PATTERNUNITS, "patternUnits"},
279 {SP_ATTR_PATTERNCONTENTUNITS, "patternContentUnits"},
280 {SP_ATTR_PATTERNTRANSFORM, "patternTransform"},
281 /* SPClipPath */
282 {SP_ATTR_CLIPPATHUNITS, "clipPathUnits"},
283 /* SPMask */
284 {SP_ATTR_MASKUNITS, "maskUnits"},
285 {SP_ATTR_MASKCONTENTUNITS, "maskContentUnits"},
286 /* SPMarker */
287 {SP_ATTR_MARKERUNITS, "markerUnits"},
288 {SP_ATTR_REFX, "refX"},
289 {SP_ATTR_REFY, "refY"},
290 {SP_ATTR_MARKERWIDTH, "markerWidth"},
291 {SP_ATTR_MARKERHEIGHT, "markerHeight"},
292 {SP_ATTR_ORIENT, "orient"},
293 /* SPStyleElem */
294 //{SP_ATTR_TYPE, "type"},
295 /* Animations */
296 {SP_ATTR_ATTRIBUTENAME, "attributeName"},
297 {SP_ATTR_ATTRIBUTETYPE, "attributeType"},
298 {SP_ATTR_BEGIN, "begin"},
299 {SP_ATTR_DUR, "dur"},
300 {SP_ATTR_END, "end"},
301 {SP_ATTR_MIN, "min"},
302 {SP_ATTR_MAX, "max"},
303 {SP_ATTR_RESTART, "restart"},
304 {SP_ATTR_REPEATCOUNT, "repeatCount"},
305 {SP_ATTR_REPEATDUR, "repeatDur"},
306 /* Interpolating animations */
307 {SP_ATTR_CALCMODE, "calcMode"},
308 //{SP_ATTR_VALUES, "values"},
309 {SP_ATTR_KEYTIMES, "keyTimes"},
310 {SP_ATTR_KEYSPLINES, "keySplines"},
311 {SP_ATTR_FROM, "from"},
312 {SP_ATTR_TO, "to"},
313 {SP_ATTR_BY, "by"},
314 {SP_ATTR_ADDITIVE, "additive"},
315 {SP_ATTR_ACCUMULATE, "accumulate"},
317 /* SVGFonts */
318 /*<font>*/
319 {SP_ATTR_HORIZ_ORIGIN_X, "horiz-origin-x"},
320 {SP_ATTR_HORIZ_ORIGIN_Y, "horiz-origin-y"},
321 {SP_ATTR_HORIZ_ADV_X, "horiz-adv-x"},
322 {SP_ATTR_VERT_ORIGIN_X, "vert-origin-x"},
323 {SP_ATTR_VERT_ORIGIN_Y, "vert-origin-y"},
324 {SP_ATTR_VERT_ADV_Y, "vert-adv-y"},
326 /*<glyph>*/
327 {SP_ATTR_UNICODE, "unicode"},
328 {SP_ATTR_GLYPH_NAME, "glyph-name"},
329 //{SP_ATTR_ORIENTATION, "orientation"},
330 {SP_ATTR_ARABIC_FORM, "arabic-form"},
331 {SP_ATTR_LANG, "lang"},
333 /*<hkern> and <vkern>*/
334 {SP_ATTR_U1, "u1"},
335 {SP_ATTR_G1, "g1"},
336 {SP_ATTR_U2, "u2"},
337 {SP_ATTR_G2, "g2"},
338 {SP_ATTR_K, "k"},
340 /*<font-face>*/
341 //{SP_ATTR_FONT_FAMILY, "font-family"}, these are already set for CSS2 (SP_PROP_FONT_FAMILY, SP_PROP_FONT_STYLE, SP_PROP_FONT_VARIANT etc...)
342 //{SP_ATTR_FONT_STYLE, "font-style"},
343 //{SP_ATTR_FONT_VARIANT, "font-variant"},
344 //{SP_ATTR_FONT_WEIGHT, "font-weight"},
345 //{SP_ATTR_FONT_STRETCH, "font-stretch"},
346 //{SP_ATTR_FONT_SIZE, "font-size"},
347 {SP_ATTR_UNICODE_RANGE, "unicode-range"},
348 {SP_ATTR_UNITS_PER_EM, "units-per-em"},
349 {SP_ATTR_PANOSE_1, "panose-1"},
350 {SP_ATTR_STEMV, "stemv"},
351 {SP_ATTR_STEMH, "stemh"},
352 //{SP_ATTR_SLOPE, "slope"},
353 {SP_ATTR_CAP_HEIGHT, "cap-height"},
354 {SP_ATTR_X_HEIGHT, "x-height"},
355 {SP_ATTR_ACCENT_HEIGHT, "accent-height"},
356 {SP_ATTR_ASCENT, "ascent"},
357 {SP_ATTR_DESCENT, "descent"},
358 {SP_ATTR_WIDTHS, "widths"},
359 {SP_ATTR_BBOX, "bbox"},
360 {SP_ATTR_IDEOGRAPHIC, "ideographic"},
361 {SP_ATTR_ALPHABETIC, "alphabetic"},
362 {SP_ATTR_MATHEMATICAL, "mathematical"},
363 {SP_ATTR_HANGING, "hanging"},
364 {SP_ATTR_V_IDEOGRAPHIC, "v-ideographic"},
365 {SP_ATTR_V_ALPHABETIC, "v-alphabetic"},
366 {SP_ATTR_V_MATHEMATICAL, "v-mathematical"},
367 {SP_ATTR_V_HANGING, "v-hanging"},
368 {SP_ATTR_UNDERLINE_POSITION, "underline-position"},
369 {SP_ATTR_UNDERLINE_THICKNESS, "underline-thickness"},
370 {SP_ATTR_STRIKETHROUGH_POSITION, "strikethrough-position"},
371 {SP_ATTR_STRIKETHROUGH_THICKNESS, "strikethrough-thickness"},
372 {SP_ATTR_OVERLINE_POSITION, "overline-position"},
373 {SP_ATTR_OVERLINE_THICKNESS, "overline-thickness"},
375 /* XML */
376 {SP_ATTR_XML_SPACE, "xml:space"},
378 /* typeset */
379 {SP_ATTR_TEXT_NOMARKUP, "inkscape:srcNoMarkup"},
380 {SP_ATTR_TEXT_PANGOMARKUP, "inkscape:srcPango" },
381 {SP_ATTR_TEXT_INSHAPE, "inkscape:dstShape"},
382 {SP_ATTR_TEXT_ONPATH, "inkscape:dstPath"},
383 {SP_ATTR_TEXT_INBOX,"inkscape:dstBox"},
384 {SP_ATTR_TEXT_INCOLUMN,"inkscape:dstColumn"},
385 {SP_ATTR_TEXT_EXCLUDE,"inkscape:excludeShape"},
386 {SP_ATTR_LAYOUT_OPTIONS,"inkscape:layoutOptions"},
388 /* CSS2 */
389 {SP_PROP_INKSCAPE_FONT_SPEC, "-inkscape-font-specification"},
390 /* Font */
391 {SP_PROP_FONT, "font"},
392 {SP_PROP_FONT_FAMILY, "font-family"},
393 {SP_PROP_FONT_SIZE, "font-size"},
394 {SP_PROP_FONT_SIZE_ADJUST, "font-size-adjust"},
395 {SP_PROP_FONT_STRETCH, "font-stretch"},
396 {SP_PROP_FONT_STYLE, "font-style"},
397 {SP_PROP_FONT_VARIANT, "font-variant"},
398 {SP_PROP_FONT_WEIGHT, "font-weight"},
399 /* Text */
400 {SP_PROP_TEXT_INDENT, "text-indent"},
401 {SP_PROP_TEXT_ALIGN, "text-align"},
402 {SP_PROP_TEXT_DECORATION, "text-decoration"},
403 {SP_PROP_LINE_HEIGHT, "line-height"},
404 {SP_PROP_LETTER_SPACING, "letter-spacing"},
405 {SP_PROP_WORD_SPACING, "word-spacing"},
406 {SP_PROP_TEXT_TRANSFORM, "text-transform"},
407 /* Text (css3) */
408 {SP_PROP_DIRECTION, "direction"},
409 {SP_PROP_BLOCK_PROGRESSION, "block-progression"},
410 {SP_PROP_WRITING_MODE, "writing-mode"},
411 {SP_PROP_UNICODE_BIDI, "unicode-bidi"},
412 {SP_PROP_ALIGNMENT_BASELINE, "alignment-baseline"},
413 {SP_PROP_BASELINE_SHIFT, "baseline-shift"},
414 {SP_PROP_DOMINANT_BASELINE, "dominant-baseline"},
415 {SP_PROP_GLYPH_ORIENTATION_HORIZONTAL, "glyph-orientation-horizontal"},
416 {SP_PROP_GLYPH_ORIENTATION_VERTICAL, "glyph-orientation-vertical"},
417 {SP_PROP_KERNING, "kerning"},
418 {SP_PROP_TEXT_ANCHOR, "text-anchor"},
419 /* Misc */
420 {SP_PROP_CLIP, "clip"},
421 {SP_PROP_COLOR, "color"},
422 {SP_PROP_CURSOR, "cursor"},
423 {SP_PROP_DISPLAY, "display"},
424 {SP_PROP_OVERFLOW, "overflow"},
425 {SP_PROP_VISIBILITY, "visibility"},
426 /* SVG */
427 /* Clip/Mask */
428 {SP_PROP_CLIP_PATH, "clip-path"},
429 {SP_PROP_CLIP_RULE, "clip-rule"},
430 {SP_PROP_MASK, "mask"},
431 {SP_PROP_OPACITY, "opacity"},
432 /* Filter */
433 {SP_PROP_ENABLE_BACKGROUND, "enable-background"},
434 {SP_PROP_FILTER, "filter"},
435 {SP_PROP_FLOOD_COLOR, "flood-color"},
436 {SP_PROP_FLOOD_OPACITY, "flood-opacity"},
437 {SP_PROP_LIGHTING_COLOR, "lighting-color"},
438 /* Gradient */
439 {SP_PROP_STOP_COLOR, "stop-color"},
440 {SP_PROP_STOP_OPACITY, "stop-opacity"},
441 /* Interactivity */
442 {SP_PROP_POINTER_EVENTS, "pointer-events"},
443 /* Paint */
444 {SP_PROP_COLOR_INTERPOLATION, "color-interpolation"},
445 {SP_PROP_COLOR_INTERPOLATION_FILTERS, "color-interpolation-filters"},
446 {SP_PROP_COLOR_PROFILE, "color-profile"},
447 {SP_PROP_COLOR_RENDERING, "color-rendering"},
448 {SP_PROP_FILL, "fill"},
449 {SP_PROP_FILL_OPACITY, "fill-opacity"},
450 {SP_PROP_FILL_RULE, "fill-rule"},
451 {SP_PROP_IMAGE_RENDERING, "image-rendering"},
452 {SP_PROP_MARKER, "marker"},
453 {SP_PROP_MARKER_END, "marker-end"},
454 {SP_PROP_MARKER_MID, "marker-mid"},
455 {SP_PROP_MARKER_START, "marker-start"},
456 {SP_PROP_SHAPE_RENDERING, "shape-rendering"},
457 {SP_PROP_STROKE, "stroke"},
458 {SP_PROP_STROKE_DASHARRAY, "stroke-dasharray"},
459 {SP_PROP_STROKE_DASHOFFSET, "stroke-dashoffset"},
460 {SP_PROP_STROKE_LINECAP, "stroke-linecap"},
461 {SP_PROP_STROKE_LINEJOIN, "stroke-linejoin"},
462 {SP_PROP_STROKE_MITERLIMIT, "stroke-miterlimit"},
463 {SP_PROP_STROKE_OPACITY, "stroke-opacity"},
464 {SP_PROP_STROKE_WIDTH, "stroke-width"},
465 {SP_PROP_TEXT_RENDERING, "text-rendering"},
466 /* Conditional */
467 {SP_PROP_SYSTEM_LANGUAGE, "systemLanguage"},
468 {SP_PROP_REQUIRED_FEATURES, "requiredFeatures"},
469 {SP_PROP_REQUIRED_EXTENSIONS, "requiredExtensions"},
470 /* LivePathEffect */
471 {SP_PROP_PATH_EFFECT, "effect"},
472 };
474 #define n_attrs (sizeof(props) / sizeof(props[0]))
476 /** Returns an SPAttributeEnum; SP_ATTR_INVALID (of value 0) if key isn't recognized. */
477 unsigned
478 sp_attribute_lookup(gchar const *key)
479 {
480 static GHashTable *propdict = NULL;
482 if (!propdict) {
483 unsigned int i;
484 propdict = g_hash_table_new(g_str_hash, g_str_equal);
485 for (i = 1; i < n_attrs; i++) {
486 g_assert(props[i].code == static_cast< gint >(i) );
487 g_hash_table_insert(propdict,
488 const_cast<void *>(static_cast<void const *>(props[i].name)),
489 GINT_TO_POINTER(props[i].code));
490 }
491 }
493 return GPOINTER_TO_UINT(g_hash_table_lookup(propdict, key));
494 }
496 unsigned char const *
497 sp_attribute_name(unsigned int id)
498 {
499 if (id >= n_attrs) {
500 return NULL;
501 }
503 return (unsigned char*)props[id].name;
504 }
507 /*
508 Local Variables:
509 mode:c++
510 c-file-style:"stroustrup"
511 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
512 indent-tabs-mode:nil
513 fill-column:99
514 End:
515 */
516 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :