~ubuntu-branches/ubuntu/precise/inkscape/precise-updates

« back to all changes in this revision

Viewing changes to src/sp-glyph.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alex Valavanis
  • Date: 2010-09-12 19:44:58 UTC
  • mfrom: (1.1.12 upstream) (45.1.3 maverick)
  • Revision ID: james.westby@ubuntu.com-20100912194458-4sjwmbl7dlsrk5dc
Tags: 0.48.0-1ubuntu1
* Merge with Debian unstable (LP: #628048, LP: #401567, LP: #456248, 
  LP: #463602, LP: #591986)
* debian/control: 
  - Ubuntu maintainers
  - Promote python-lxml, python-numpy, python-uniconvertor to Recommends.
  - Demote pstoedit to Suggests (universe package).
  - Suggests ttf-dejavu instead of ttf-bitstream-vera (LP: #513319)
* debian/rules:
  - Run intltool-update on build (Ubuntu-specific).
  - Add translation domain to .desktop files (Ubuntu-specific).
* debian/dirs:
  - Add usr/share/pixmaps.  Allow inkscape.xpm installation
* drop 50-poppler-API.dpatch (now upstream)
* drop 51-paste-in-unwritable-directory.dpatch (now upstream) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 * SVG <glyph> element implementation
10
10
 *
11
11
 * Author:
12
 
 *   Felipe C. da S. Sanches <felipe.sanches@gmail.com>
 
12
 *   Felipe C. da S. Sanches <juca@members.fsf.org>
13
13
 *
14
14
 * Copyright (C) 2008, Felipe C. da S. Sanches
15
15
 *
20
20
#include "attributes.h"
21
21
#include "sp-glyph.h"
22
22
#include "document.h"
23
 
#include "helper-fns.h"
24
23
 
25
24
static void sp_glyph_class_init(SPGlyphClass *gc);
26
25
static void sp_glyph_init(SPGlyph *glyph);
146
145
static void sp_glyph_set(SPObject *object, unsigned int key, const gchar *value)
147
146
{
148
147
    SPGlyph *glyph = SP_GLYPH(object);
149
 
    double number;
150
 
    glyphOrientation orient;
151
 
    glyphArabicForm form;
152
148
 
153
149
    switch (key) {
154
150
        case SP_ATTR_UNICODE:
 
151
        {
155
152
            glyph->unicode.clear();
156
153
            if (value) glyph->unicode.append(value);
157
154
            object->requestModified(SP_OBJECT_MODIFIED_FLAG);
158
155
            break;
 
156
        }
159
157
        case SP_ATTR_GLYPH_NAME:
 
158
        {
160
159
            glyph->glyph_name.clear();
161
160
            if (value) glyph->glyph_name.append(value);
162
161
            object->requestModified(SP_OBJECT_MODIFIED_FLAG);
163
162
            break;
 
163
        }
164
164
        case SP_ATTR_D:
 
165
        {
165
166
            if (glyph->d) g_free(glyph->d);
166
167
            glyph->d = g_strdup(value);
167
168
            object->requestModified(SP_OBJECT_MODIFIED_FLAG);
168
169
            break;
 
170
        }
169
171
        case SP_ATTR_ORIENTATION:
170
 
            orient = sp_glyph_read_orientation(value);
 
172
        {
 
173
            glyphOrientation orient = sp_glyph_read_orientation(value);
171
174
            if (glyph->orientation != orient){
172
175
                glyph->orientation = orient;
173
176
                object->requestModified(SP_OBJECT_MODIFIED_FLAG);
174
177
            }
175
178
            break;
 
179
        }
176
180
        case SP_ATTR_ARABIC_FORM:
177
 
            form = sp_glyph_read_arabic_form(value);
 
181
        {
 
182
            glyphArabicForm form = sp_glyph_read_arabic_form(value);
178
183
            if (glyph->arabic_form != form){
179
184
                glyph->arabic_form = form;
180
185
                object->requestModified(SP_OBJECT_MODIFIED_FLAG);
181
186
            }
182
187
            break;
 
188
        }
183
189
        case SP_ATTR_LANG:
 
190
        {
184
191
            if (glyph->lang) g_free(glyph->lang);
185
192
            glyph->lang = g_strdup(value);
186
193
            object->requestModified(SP_OBJECT_MODIFIED_FLAG);
187
194
            break;
188
 
        case SP_ATTR_HORIZ_ADV_X:
189
 
            number = helperfns_read_number(value);
 
195
        }
 
196
        case SP_ATTR_HORIZ_ADV_X:
 
197
        {
 
198
            double number = value ? g_ascii_strtod(value, 0) : 0;
190
199
            if (number != glyph->horiz_adv_x){
191
200
                glyph->horiz_adv_x = number;
192
201
                object->requestModified(SP_OBJECT_MODIFIED_FLAG);
193
202
            }
194
203
            break;
195
 
        case SP_ATTR_VERT_ORIGIN_X:
196
 
            number = helperfns_read_number(value);
 
204
        }
 
205
        case SP_ATTR_VERT_ORIGIN_X:
 
206
        {
 
207
            double number = value ? g_ascii_strtod(value, 0) : 0;
197
208
            if (number != glyph->vert_origin_x){
198
209
                glyph->vert_origin_x = number;
199
210
                object->requestModified(SP_OBJECT_MODIFIED_FLAG);
200
211
            }
201
212
            break;
202
 
        case SP_ATTR_VERT_ORIGIN_Y:
203
 
            number = helperfns_read_number(value);
 
213
        }
 
214
        case SP_ATTR_VERT_ORIGIN_Y:
 
215
        {
 
216
            double number = value ? g_ascii_strtod(value, 0) : 0;
204
217
            if (number != glyph->vert_origin_y){
205
218
                glyph->vert_origin_y = number;
206
219
                object->requestModified(SP_OBJECT_MODIFIED_FLAG);
207
220
            }
208
221
            break;
209
 
        case SP_ATTR_VERT_ADV_Y:
210
 
            number = helperfns_read_number(value);
 
222
        }
 
223
        case SP_ATTR_VERT_ADV_Y:
 
224
        {
 
225
            double number = value ? g_ascii_strtod(value, 0) : 0;
211
226
            if (number != glyph->vert_adv_y){
212
227
                glyph->vert_adv_y = number;
213
228
                object->requestModified(SP_OBJECT_MODIFIED_FLAG);
214
229
            }
215
230
            break;
216
 
        default:
 
231
        }
 
232
        default:
 
233
        {
217
234
            if (((SPObjectClass *) (parent_class))->set) {
218
235
                ((SPObjectClass *) (parent_class))->set(object, key, value);
219
236
            }
220
237
            break;
 
238
        }
221
239
    }
222
240
}
223
241