Beispiel #1
0
gchar *
sp_repr_css_write_string(SPCSSAttr *css)
{
    Glib::ustring buffer;

    for ( List<AttributeRecord const> iter = css->attributeList() ;
          iter ; ++iter )
    {
        if (iter->value && !strcmp(iter->value, "inkscape:unset")) {
            continue;
        }

        buffer.append(g_quark_to_string(iter->key));
        buffer.push_back(':');
        if (!strcmp(g_quark_to_string(iter->key), "font-family")
                || !strcmp(g_quark_to_string(iter->key), "-inkscape-font-specification")) {
            // we only quote font-family/font-specification, as SPStyle does
            gchar *t = g_strdup (iter->value);
            g_free (t);
            gchar *val_quoted = css2_escape_quote (iter->value);
            if (val_quoted) {
                buffer.append(val_quoted);
                g_free (val_quoted);
            }
        } else {
            buffer.append(iter->value); // unquoted
        }

        if (rest(iter)) {
            buffer.push_back(';');
        }
    }

    return (buffer.empty() ? NULL : g_strdup (buffer.c_str()));
}
Beispiel #2
0
/**
 * Reads a line of data from the reader.
 */ 
Glib::ustring BasicReader::readWord()
{
    Glib::ustring str;
    while (available() > 0)
        {
        gunichar ch = get();
        if (!g_unichar_isprint(ch))
            break;
        str.push_back(ch);
        }
    return str;
}
Beispiel #3
0
/**
 * Reads a line of data from the reader.
 */ 
Glib::ustring BasicReader::readLine()
{
    Glib::ustring str;
    while (available() > 0)
        {
        gunichar ch = get();
        if (ch == '\n')
            break;
        str.push_back(ch);
        }
    return str;
}