diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-11-13 00:32:03 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-11-13 00:32:03 +0800 |
commit | d0b96ec1c87ce1d5971a4cea9073c68843214a71 (patch) | |
tree | 388f601e382c63b4f51f7615a2d84acfb82effc5 /data/generate-font-schemas.py | |
parent | cba54efb932a4bf8402ff3f9f17904dcb3c496f2 (diff) | |
download | gsoc2013-epiphany-d0b96ec1c87ce1d5971a4cea9073c68843214a71.tar gsoc2013-epiphany-d0b96ec1c87ce1d5971a4cea9073c68843214a71.tar.gz gsoc2013-epiphany-d0b96ec1c87ce1d5971a4cea9073c68843214a71.tar.bz2 gsoc2013-epiphany-d0b96ec1c87ce1d5971a4cea9073c68843214a71.tar.lz gsoc2013-epiphany-d0b96ec1c87ce1d5971a4cea9073c68843214a71.tar.xz gsoc2013-epiphany-d0b96ec1c87ce1d5971a4cea9073c68843214a71.tar.zst gsoc2013-epiphany-d0b96ec1c87ce1d5971a4cea9073c68843214a71.zip |
Add schema entries for the fonts keys.
2005-11-12 Christian Persch <chpe@cvs.gnome.org>
* data/Makefile.am:
* data/default-prefs-common.js:
* data/generate-font-schemas.py:
* data/epiphany-fonts.schemas:
Add schema entries for the fonts keys.
Diffstat (limited to 'data/generate-font-schemas.py')
-rwxr-xr-x | data/generate-font-schemas.py | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/data/generate-font-schemas.py b/data/generate-font-schemas.py new file mode 100755 index 000000000..fc7717f8a --- /dev/null +++ b/data/generate-font-schemas.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- +# +# Copyright (C) 2005 Christian Persch +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# $Id$ + +import sys, codecs +from xml import dom; + +sys.stdout = codecs.getwriter("utf-8")(sys.__stdout__) + +def appendTextNode(doc, schemaNode, tag, text): + node = doc.createElement(tag) + schemaNode.appendChild(node) + textNode = doc.createTextNode(text) + node.appendChild(textNode) + + +def appendLocaleNode(doc, schemaNode, localeName, shortSchemaText): + localeNode = doc.createElement("locale") + localeNode.setAttribute("name", localeName) + schemaNode.appendChild(localeNode) + + appendTextNode(doc, localeNode, "short", shortSchemaText) + appendTextNode(doc, localeNode, "long", shortSchemaText) + + +def append_schema(doc, schemalistNode, key, datatype, default, description, schemaText): + schemaNode = doc.createElement("schema") + schemalistNode.appendChild(schemaNode) + appendTextNode (doc, schemaNode, "key", "/schemas" + key) + appendTextNode (doc, schemaNode, "applyto", key) + appendTextNode (doc, schemaNode, "owner", "epiphany") + appendTextNode (doc, schemaNode, "type", datatype) + appendTextNode (doc, schemaNode, "default", default) + appendLocaleNode (doc, schemaNode, "C", schemaText) + + +def append_schemas(docNode, schemalistNode, group): + base = "/apps/epiphany/web/" + append_schema(doc, schemalistNode, base + "fixed_font_size_" + group, + "int", "10", "Monospace font size", + "Monospaced font size for \"" + group + "\"") + append_schema(doc, schemalistNode, base + "font_monospace_" + group, + "string", "monospace", "Monospace font", + "Monospaced font for \"" + group + "\"") + append_schema(doc, schemalistNode, base + "variable_font_size_" + group, + "int", "11", "Proportional font size", + "Variable width font size for \"" + group + "\"") + append_schema(doc, schemalistNode, base + "font_variable_" + group, + "string", "sans-serif", "Proportional font", + "Variable width font for \"" + group + "\"") + append_schema(doc, schemalistNode, base + "minimum_font_size_" + group, + "int", "7", "Minimum font size", + "Minimum font size for \"" + group + "\"") + + +# keep this list in sync with lib/ephy-langs.c +font_languages = [ + "ar", + "el", + "he", + "ja", + "ko", + "th", + "tr", + "x-armn", + "x-baltic", + "x-beng", + "x-cans", + "x-central-euro", + "x-cyrillic", + "x-devanagari", + "x-ethi", + "x-geor", + "x-gujr", + "x-guru", + "x-khmr", + "x-mlym", + "x-tamil", + "x-unicode", + "x-western", + "zh-CN", + "zh-HK", + "zh-TW" ] + +doc = dom.getDOMImplementation().createDocument(None, "gconfschemafile", None) + +schemalistNode = doc.createElement("schemalist") +doc.documentElement.appendChild(schemalistNode) + +for lang in font_languages: + append_schemas(doc, schemalistNode, lang) + +doc.writexml(sys.stdout) + +# Remember to pass the output through "xmllint --format" |