Next: , Previous: PangoRenderer, Up: Top

8 Scripts

Identifying writing systems

8.1 Overview

The functions in this section are used to identify the writing system, or script of individual characters and of ranges within a larger text string.

8.2 Usage

— Class: <pango-script-iter>

Opaque pointer.

This class defines no direct slots.

— Function: pango-script-for-unichar (ch unsigned-int32) ⇒  (ret <pango-script>)

Looks up the <pango-script> for a particular character (as defined by Unicode Standard Annex <24>). No check is made for ch being a valid Unicode character; if you pass in invalid character, the result is undefined.

a Unicode character
the <pango-script> for the character.

Since 1.4

— Function: pango-script-get-sample-language (script <pango-script>) ⇒  (ret <pango-language>)

Given a script, finds a language tag that is reasonably representative of that script. This will usually be the most widely spoken or used language written in that script: for instance, the sample language for ‘PANGO_SCRIPT_CYRILLIC’ is ‘ru’ (Russian), the sample language for ‘PANGO_SCRIPT_ARABIC’ is ‘ar’.

For some scripts, no sample language will be returned because there is no language that is sufficiently representative. The best example of this is ‘PANGO_SCRIPT_HAN’, where various different variants of written Chinese, Japanese, and Korean all use significantly different sets of Han characters and forms of shared characters. No sample language can be provided for many historical scripts as well.

a <pango-script>
a <pango-language> that is representative of the script, or ‘#f’ if no such language exists.

Since 1.4

— Function: pango-language-includes-script (self <pango-language>) (script <pango-script>) ⇒  (ret bool)

Determines if script is one of the scripts used to write language. The returned value is conservative; if nothing is known about the language tag language, ‘#t’ will be returned, since, as far as Pango knows, script might be used to write language.

This routine is used in Pango's itemization process when determining if a supplied language tag is relevant to a particular section of text. It probably is not useful for applications in most circumstances.

a <pango-language>
a <pango-script>
#t’ if script is one of the scripts used to write language, or if nothing is known about language.

Since 1.4

— Function: pango-script-iter-new (text mchars) (length int) ⇒  (ret <pango-script-iter>)

Create a new <pango-script-iter>, used to break a string of Unicode into runs by text. No copy is made of text, so the caller needs to make sure it remains valid until the iterator is freed with pango-script-iter-free.x

a UTF-8 string
length of text, or -1 if text is nul-terminated.
the new script iterator, initialized to point at the first range in the text, which should be freed with pango-script-iter-free. If the string is empty, it will point at an empty range.

Since 1.4

— Function: pango-script-iter-next (self <pango-script-iter>) ⇒  (ret bool)

Advances a <pango-script-iter> to the next range. If iter is already at the end, it is left unchanged and ‘#f’ is returned.

a <pango-script-iter>
#t’ if iter was successfully advanced.

Since 1.4