Git init
[external/pango1.0.git] / pango / pangofc-decoder.c
1 /* Pango
2  * pangofc-decoder.c: Custom font encoder/decoders
3  *
4  * Copyright (C) 2004 Red Hat Software
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #include "config.h"
23 #include "pangofc-decoder.h"
24
25 G_DEFINE_ABSTRACT_TYPE (PangoFcDecoder, pango_fc_decoder, G_TYPE_OBJECT)
26
27 static void
28 pango_fc_decoder_init (PangoFcDecoder *decoder G_GNUC_UNUSED)
29 {
30 }
31
32 static void
33 pango_fc_decoder_class_init (PangoFcDecoderClass *klass G_GNUC_UNUSED)
34 {
35 }
36
37 /**
38  * pango_fc_decoder_get_charset:
39  * @decoder: a #PangoFcDecoder
40  * @fcfont: the #PangoFcFont to query.
41  *
42  * Generates an #FcCharSet of supported characters for the fcfont
43  * given.  The returned #FcCharSet will be a reference to an
44  * internal value stored by the #PangoFcDecoder and must not
45  * be modified or freed.
46  *
47  * Return value: the #FcCharset for @fcfont; must not be modified
48  *   or freed.
49  *
50  * Since: 1.6
51  **/
52 FcCharSet *
53 pango_fc_decoder_get_charset (PangoFcDecoder *decoder,
54                               PangoFcFont    *fcfont)
55 {
56   g_return_val_if_fail (PANGO_IS_FC_DECODER (decoder), NULL);
57
58   return PANGO_FC_DECODER_GET_CLASS (decoder)->get_charset (decoder, fcfont);
59 }
60
61 /**
62  * pango_fc_decoder_get_glyph:
63  * @decoder: a #PangoFcDecoder
64  * @fcfont: a #PangoFcFont to query.
65  * @wc: the Unicode code point to convert to a single #PangoGlyph.
66  *
67  * Generates a #PangoGlyph for the given Unicode point using the
68  * custom decoder. For complex scripts where there can be multiple
69  * glyphs for a single character, the decoder will return whatever
70  * glyph is most convenient for it. (Usually whatever glyph is directly
71  * in the fonts character map table.)
72  *
73  * Return value: the glyph index, or 0 if the glyph isn't
74  * covered by the font.
75  *
76  * Since: 1.6
77  **/
78 PangoGlyph
79 pango_fc_decoder_get_glyph (PangoFcDecoder *decoder,
80                             PangoFcFont    *fcfont,
81                             guint32         wc)
82 {
83   g_return_val_if_fail (PANGO_IS_FC_DECODER (decoder), 0);
84
85   return PANGO_FC_DECODER_GET_CLASS (decoder)->get_glyph (decoder, fcfont, wc);
86 }