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