Code

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