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 pango.PgLanguage;
29 private import pango.c.functions;
30 public  import pango.c.types;
31 
32 
33 /** */
34 public struct PgScript
35 {
36 
37 	/**
38 	 * Looks up the script for a particular character.
39 	 *
40 	 * The script of a character is defined by Unicode Standard Annex \#24.
41 	 * No check is made for @ch being a valid Unicode character; if you pass
42 	 * in invalid character, the result is undefined.
43 	 *
44 	 * Note that while the return type of this function is declared
45 	 * as `PangoScript`, as of Pango 1.18, this function simply returns
46 	 * the return value of g_unichar_get_script(). Callers must be
47 	 * prepared to handle unknown values.
48 	 *
49 	 * Deprecated: Use g_unichar_get_script()
50 	 *
51 	 * Params:
52 	 *     ch = a Unicode character
53 	 *
54 	 * Returns: the `PangoScript` for the character.
55 	 *
56 	 * Since: 1.4
57 	 */
58 	public static PangoScript scriptForUnichar(dchar ch)
59 	{
60 		return pango_script_for_unichar(ch);
61 	}
62 
63 	/**
64 	 * Finds a language tag that is reasonably representative of @script.
65 	 *
66 	 * The language will usually be the most widely spoken or used language written
67 	 * in that script: for instance, the sample language for %PANGO_SCRIPT_CYRILLIC
68 	 * is ru (Russian), the sample language for %PANGO_SCRIPT_ARABIC is ar.
69 	 *
70 	 * For some scripts, no sample language will be returned because
71 	 * there is no language that is sufficiently representative. The
72 	 * best example of this is %PANGO_SCRIPT_HAN, where various different
73 	 * variants of written Chinese, Japanese, and Korean all use
74 	 * significantly different sets of Han characters and forms
75 	 * of shared characters. No sample language can be provided
76 	 * for many historical scripts as well.
77 	 *
78 	 * As of 1.18, this function checks the environment variables
79 	 * `PANGO_LANGUAGE` and `LANGUAGE` (checked in that order) first.
80 	 * If one of them is set, it is parsed as a list of language tags
81 	 * separated by colons or other separators. This function
82 	 * will return the first language in the parsed list that Pango
83 	 * believes may use @script for writing. This last predicate
84 	 * is tested using [method@Pango.Language.includes_script]. This can
85 	 * be used to control Pango's font selection for non-primary
86 	 * languages. For example, a `PANGO_LANGUAGE` enviroment variable
87 	 * set to "en:fa" makes Pango choose fonts suitable for Persian (fa)
88 	 * instead of Arabic (ar) when a segment of Arabic text is found
89 	 * in an otherwise non-Arabic text. The same trick can be used to
90 	 * choose a default language for %PANGO_SCRIPT_HAN when setting
91 	 * context language is not feasible.
92 	 *
93 	 * Params:
94 	 *     script = a `PangoScript`
95 	 *
96 	 * Returns: a `PangoLanguage` that is representative
97 	 *     of the script, or %NULL if no such language exists.
98 	 *
99 	 * Since: 1.4
100 	 */
101 	public static PgLanguage scriptGetSampleLanguage(PangoScript script)
102 	{
103 		auto __p = pango_script_get_sample_language(script);
104 
105 		if(__p is null)
106 		{
107 			return null;
108 		}
109 
110 		return ObjectG.getDObject!(PgLanguage)(cast(PangoLanguage*) __p, true);
111 	}
112 }