1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module pango.PgScript;
26 
27 private import gobject.ObjectG;
28 private import gtkc.pango;
29 public  import gtkc.pangotypes;
30 private import pango.PgLanguage;
31 
32 
33 public struct PgScript
34 {
35 	/**
36 	 */
37 
38 	/**
39 	 * Looks up the #PangoScript for a particular character (as defined by
40 	 * Unicode Standard Annex \#24). No check is made for @ch being a
41 	 * valid Unicode character; if you pass in invalid character, the
42 	 * result is undefined.
43 	 *
44 	 * As of Pango 1.18, this function simply returns the return value of
45 	 * g_unichar_get_script().
46 	 *
47 	 * Params:
48 	 *     ch = a Unicode character
49 	 *
50 	 * Return: the #PangoScript for the character.
51 	 *
52 	 * Since: 1.4
53 	 */
54 	public static PangoScript scriptForUnichar(dchar ch)
55 	{
56 		return pango_script_for_unichar(ch);
57 	}
58 
59 	/**
60 	 * Given a script, finds a language tag that is reasonably
61 	 * representative of that script. This will usually be the
62 	 * most widely spoken or used language written in that script:
63 	 * for instance, the sample language for %PANGO_SCRIPT_CYRILLIC
64 	 * is <literal>ru</literal> (Russian), the sample language
65 	 * for %PANGO_SCRIPT_ARABIC is <literal>ar</literal>.
66 	 *
67 	 * For some
68 	 * scripts, no sample language will be returned because there
69 	 * is no language that is sufficiently representative. The best
70 	 * example of this is %PANGO_SCRIPT_HAN, where various different
71 	 * variants of written Chinese, Japanese, and Korean all use
72 	 * significantly different sets of Han characters and forms
73 	 * of shared characters. No sample language can be provided
74 	 * for many historical scripts as well.
75 	 *
76 	 * As of 1.18, this function checks the environment variables
77 	 * PANGO_LANGUAGE and LANGUAGE (checked in that order) first.
78 	 * If one of them is set, it is parsed as a list of language tags
79 	 * separated by colons or other separators.  This function
80 	 * will return the first language in the parsed list that Pango
81 	 * believes may use @script for writing.  This last predicate
82 	 * is tested using pango_language_includes_script().  This can
83 	 * be used to control Pango's font selection for non-primary
84 	 * languages.  For example, a PANGO_LANGUAGE enviroment variable
85 	 * set to "en:fa" makes Pango choose fonts suitable for Persian (fa)
86 	 * instead of Arabic (ar) when a segment of Arabic text is found
87 	 * in an otherwise non-Arabic text.  The same trick can be used to
88 	 * choose a default language for %PANGO_SCRIPT_HAN when setting
89 	 * context language is not feasible.
90 	 *
91 	 * Params:
92 	 *     script = a #PangoScript
93 	 *
94 	 * Return: a #PangoLanguage that is representative
95 	 *     of the script, or %NULL if no such language exists.
96 	 *
97 	 * Since: 1.4
98 	 */
99 	public static PgLanguage scriptGetSampleLanguage(PangoScript script)
100 	{
101 		auto p = pango_script_get_sample_language(script);
102 		
103 		if(p is null)
104 		{
105 			return null;
106 		}
107 		
108 		return ObjectG.getDObject!(PgLanguage)(cast(PangoLanguage*) p);
109 	}
110 }