diff options
author | Havoc Pennington <hp@pobox.com> | 2000-11-01 06:46:29 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-11-01 06:46:29 +0000 |
commit | b00a32cc4f7b8783d673f31502b4ef3555486995 (patch) | |
tree | 2a035c680e76bdfa121585577de26a4796e46345 /docs/pango_markup.sgml | |
parent | 717a0b958c4616753798250985558cab328a6837 (diff) | |
download | pango-b00a32cc4f7b8783d673f31502b4ef3555486995.tar.gz |
Add a new attribute for scaling a font; also required adding
2000-11-01 Havoc Pennington <hp@pobox.com>
* pango/pango-attributes.c (pango_attr_scale_new): Add a new
attribute for scaling a font; also required adding PangoAttrFloat.
(pango_attr_iterator_get_font): Add PANGO_ATTR_SCALE handling.
* pango/pango-utils.c (pango_parse_stretch): Take a plain string
not a GString
(pango_parse_weight): ditto
(pango_parse_variant): ditto
(pango_parse_style): ditto
* pango/pangox-fontmap.c (pango_x_font_map_read_alias_file): pass
GString::str instead of the GString itself to pango_parse_*
* pango/pangoft2-fontmap.c (pango_ft2_insert_face): ditto
* pango/pangowin32-fontmap.c
(pango_win32_font_map_read_alias_file): ditto
* pango/pango-layout.c (get_tab_pos): adapt to new pango_itemize()
signature
(pango_layout_check_lines): Raise attr list copy/creation out of
the loop over paragraphs. Adapt to pango_itemize() changes.
* pango/pango-context.c (pango_itemize): pass in a starting
index and a cached iterator
(add_engines): Easy optimization, pass in
n_chars instead of recomputing it. Also, pass on the start
index and cached iterator.
* docs/pango-sections.txt: Add new stuff
docs/pango_markup.sgml: Docs on markup format
* pango/pango-layout.c (pango_layout_get_attributes): New function
to retrieve the AttrList from a layout
(pango_layout_set_markup): Set layout from markup
(pango_layout_set_markup_with_accel): Set layout from markup
including accelerator parsing.
* pango/pango-attributes.h (pango_parse_markup): New function to
convert a tag string to an attribute list
* pango/pango-markup.c (pango_parse_markup): implement
* docs/Makefile.am, docs/pango-docs.sgml, docs/pango-sections.txt,
docs/pango_markup.sgml: oooooh, documentation for the above patch!
* docs/tmpl/pango-unused.sgml: Remove from CVS; just causes
problems, and was full of checked-in conflict markers.
Diffstat (limited to 'docs/pango_markup.sgml')
-rw-r--r-- | docs/pango_markup.sgml | 202 |
1 files changed, 202 insertions, 0 deletions
diff --git a/docs/pango_markup.sgml b/docs/pango_markup.sgml new file mode 100644 index 00000000..a0311e31 --- /dev/null +++ b/docs/pango_markup.sgml @@ -0,0 +1,202 @@ +<refentry id="PangoMarkupFormat" revision="23 Oct 2000"> +<refmeta> +<refentrytitle>Pango Text Attribute Markup</refentrytitle> +<manvolnum>3</manvolnum> +<refmiscinfo>Pango Library</refmiscinfo> +</refmeta> + +<refnamediv> +<refname>Pango Text Attribute Markup</refname><refpurpose>Simple +markup language to encode text plus a <link linkend="PangoAttrList">PangoAttrList</link></refpurpose> +</refnamediv> + +<refsect1> +<title>Pango Text Attribute Markup Language</title> + +<para> +Frequently, you want to display some text to the user with attributes +applied to part of the text (for example, you might want bold or +italicized words). With the base Pango interfaces, you could create a +#PangoAttrList and apply it to the text; the problem is that you'd +need to apply attributes to some numeric range of characters, for +example "characters 12-17." This is broken from an +internationalization standpoint; once the text is translated, the word +you wanted to italicize could be in a different position. +</para> + +<para> +The solution is to include the text attributes in the string to be +translated. Pango provides this feature with a small markup language. +You can parse a marked-up string into the string text plus a +<link linkend="PangoAttrList">PangoAttrList</link> using the function +pango_parse_markup(). +</para> + +<para> +A simple example of a marked-up string might be: +<literal>"<span foreground="blue" size="100">Blue text</span> is <i>cool</i>!"</literal> +</para> + +<para> +The root tag of a marked-up document is <markup>, but +pango_parse_markup() allows you to omit this tag, so you will most +likely never need to use it. The most general markup tag is +<span>, then there are some convenience tags. <span> has +the following attributes: +<variablelist><title><span> attributes</title> + +<varlistentry><term>font_desc</term> +<listitem><para> +A font description string, such as "Sans Italic 12"; note that any other +span attributes will override this description. So if you have "Sans +Italic" and also a style="normal" attribute, you will get Sans normal, +not italic. +</para></listitem> +</varlistentry> + +<varlistentry><term>font_family</term> +<listitem><para> +A font family name +</para></listitem> +</varlistentry> + +<varlistentry><term>face</term> +<listitem><para> +Synonym for font_family +</para></listitem> +</varlistentry> + +<varlistentry><term>size</term> +<listitem><para> +Font size in 1000ths of a point, one of the absolute sizes +'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', +'xx-large', or one of the relative sizes 'smaller' or 'larger'. +</para></listitem> +</varlistentry> + +<varlistentry><term>style</term> +<listitem><para> +One of 'normal', 'oblique', 'italic' +</para></listitem> +</varlistentry> + +<varlistentry><term>weight</term> +<listitem><para> +One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', +or a numeric weight +</para></listitem> +</varlistentry> + +<varlistentry><term>variant</term> +<listitem><para> +'normal' or 'smallcaps' +</para></listitem> +</varlistentry> + +<varlistentry><term>stretch</term> +<listitem><para> +One of 'ultracondensed', 'extracondensed', 'condensed', +'semicondensed', 'normal', 'semiexpanded', 'expanded', +'extraexpanded', 'ultraexpanded' +</para></listitem> +</varlistentry> + +<varlistentry><term>foreground</term> +<listitem><para> +An RGB color specification such as '#00FF00' or a color name such as +'red' +</para></listitem> +</varlistentry> + +<varlistentry><term>background</term> +<listitem><para> +An RGB color specification such as '#00FF00' or a color name such as +'red' +</para></listitem> +</varlistentry> + +<varlistentry><term>underline</term> +<listitem><para> +One of 'single', 'double', 'low', 'none' +</para></listitem> +</varlistentry> + +<varlistentry><term>rise</term> +<listitem><para> +Vertical displacement, in 10000ths of an em. Can be negative for +subscript, positive for superscript. +</para></listitem> +</varlistentry> + +<varlistentry><term>strikethrough</term> +<listitem><para> +'true' or 'false' whether to strike through the text +</para></listitem> +</varlistentry> + +<varlistentry><term>lang</term> +<listitem><para> +A language code, indicating the text language +</para></listitem> +</varlistentry> + +</variablelist> + +</para> + +<para> +The following convenience tags are provided: + +<variablelist><title>Convenience tags</title> +<varlistentry><term>b</term> +<listitem><para> +Bold +</para></listitem> +</varlistentry> +<varlistentry><term>big</term> +<listitem><para> +Makes font relatively larger, equivalent to <span size="larger"> +</para></listitem> +</varlistentry> +<varlistentry><term>i</term> +<listitem><para> +Italic +</para></listitem> +</varlistentry> +<varlistentry><term>s</term> +<listitem><para> +Strikethrough +</para></listitem> +</varlistentry> +<varlistentry><term>sub</term> +<listitem><para> +Subscript +</para></listitem> +</varlistentry> +<varlistentry><term>sup</term> +<listitem><para> +Superscript +</para></listitem> +</varlistentry> +<varlistentry><term>small</term> +<listitem><para> +Makes font relatively smaller, equivalent to <span size="smaller"> +</para></listitem> +</varlistentry> +<varlistentry><term>tt</term> +<listitem><para> +Monospace font +</para></listitem> +</varlistentry> +<varlistentry><term>u</term> +<listitem><para> +Underline +</para></listitem> +</varlistentry> +</variablelist> + +</para> + +</refsect1> + +</refentry> |