Allegro.pas 4.4Introduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers Examples, tools and demo game
|
Unit alUnicode
Description
Unicode support routines.
Note: I'm not sure how much this is compatible with FPC's Unicode support.
Overview
Functions and Procedures
Constants
Description
Functions and Procedures
PROCEDURE al_set_uformat (aType: AL_INT); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_uformat'; |
Sets the current text encoding format. This will affect all parts of Allegro, wherever you see a function that returns a string, or takes a string as a parameter.
Although you can change the text format on the fly, this is not a good idea. Many strings, for example the names of your hardware drivers and any language translations, are loaded when you call al_init, so if you change the encoding format after this, they will be in the wrong format, and things will not work properly. Generally you should only call al_set_uformat once, before al_init , and then leave it on the same setting for the duration of your program.
Parameters
- type
- Should be one of these values: AL_U_ASCII, AL_U_ASCII_CP, AL_U_UNICODE, AL_U_UTF8.
See also
- al_get_uformat
- Finds out what text encoding format is currently selected.
- al_set_ucodepage
- When you select the AL_U_ASCII_CP encoding mode, a set of tables are used to convert between 8-bit characters and their Unicode equivalents.
|
FUNCTION al_get_uformat: AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'get_uformat'; |
Finds out what text encoding format is currently selected. This function is probably useful only if you are writing an Allegro addon dealing with text strings and you use a different codepath for each possible format.
Returns
The currently selected text encoding format. See also
- al_set_uformat
- Sets the current text encoding format.
|
PROCEDURE al_set_ucodepage (CONST table, extras: AL_USHORTptr); CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'set_ucodepage'; |
When you select the AL_U_ASCII_CP encoding mode, a set of tables are used to convert between 8-bit characters and their Unicode equivalents. You can use this function to specify a custom set of mapping tables, which allows you to support different 8-bit codepages.
Allegro will use the table parameter when it needs to convert an ASCII string to an Unicode string. But when Allegro converts an Unicode string to ASCII, it will use both parameters. First, it will loop through the table parameter looking for an index position pointing at the Unicode value it is trying to convert (ie. the table parameter is also used for reverse matching). If that fails, the extras list is used. If that fails too, Allegro will put the character `ˆ' , giving up the conversion.
Note that Allegro comes with a default parameters set internally. The default table will convert 8-bit characters to `ˆ' . The default extras list reduces Latin-1 and Extended-A characters to 7 bits in a sensible way (eg. an accented vowel will be reduced to the same vowel without the accent).
Parameters
- table
- Points to an array of 256 short integers, which contain the Unicode value for each character in your codepage.
- extras
- If not
Nil , points to a list of mapping pairs, which will be used when reducing Unicode data to your codepage. Each pair consists of a Unicode value, followed by the way it should be represented in your codepage. The list is terminated by a zero Unicode value. This allows you to create a many->one mapping, where many different Unicode characters can be represented by a single codepage value (eg. for reducing accented vowels to 7-bit ASCII).
See also
- al_set_uformat
- Sets the current text encoding format.
|
FUNCTION al_ustrlen (s: AL_STR): AL_INT; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'ustrlen'; |
Returns
The number of characters in the string. Note that this doesn't have to equal the string's size in bytes. |
FUNCTION al_uconvert (CONST s: AL_STR; aType, newtype: AL_INT): AL_STRptr; INLINE; |
Converts the specified string s from aType to newtype , it checks before doing the conversion, and doesn't bother if the string formats are already the same (either both types are equal, or one is ASCII, the other is UTF-8, and the string contains only 7-bit ASCII characters).
See also
- al_set_uformat
- Sets the current text encoding format.
- al_uconvert_ascii
- Converts strings from ASCII into the current encoding format.
- al_uconvert_toascii
- Converts strings from the current encoding format into ASCII.
|
FUNCTION al_uconvert_ascii (CONST s: AL_STR): STRING; INLINE; |
Converts strings from ASCII into the current encoding format.
See also
- al_uconvert
- Converts the specified string
s from aType to newtype , it checks before doing the conversion, and doesn't bother if the string formats are already the same (either both types are equal, or one is ASCII, the other is UTF-8, and the string contains only 7-bit ASCII characters).
- al_uconvert_toascii
- Converts strings from the current encoding format into ASCII.
|
FUNCTION al_uconvert_toascii (CONST s: AL_STR): STRING; INLINE; |
Converts strings from the current encoding format into ASCII.
See also
- al_uconvert
- Converts the specified string
s from aType to newtype , it checks before doing the conversion, and doesn't bother if the string formats are already the same (either both types are equal, or one is ASCII, the other is UTF-8, and the string contains only 7-bit ASCII characters).
- al_uconvert_ascii
- Converts strings from ASCII into the current encoding format.
|
Constants
AL_U_ASCII = $41534338; |
Fixed size, 8-bit ASCII characters. .
See also
- al_set_uformat
- Sets the current text encoding format.
|
AL_U_ASCII_CP = $41534350; |
Alternative 8-bit codepage. .
See also
- al_set_ucodepage
- When you select the AL_U_ASCII_CP encoding mode, a set of tables are used to convert between 8-bit characters and their Unicode equivalents.
- al_set_uformat
- Sets the current text encoding format.
|
AL_U_UNICODE = $554E4943; |
Fixed size, 16-bit Unicode characters. .
See also
- al_set_uformat
- Sets the current text encoding format.
|
AL_U_UTF8 = $55544638; |
Variable size, UTF-8 format Unicode characters. .
See also
- al_set_uformat
- Sets the current text encoding format.
|
AL_U_CURRENT = $6375722E; |
Current encoding.
See also
- al_set_uformat
- Sets the current text encoding format.
|
Generated by PasDoc 0.13.0 on 2016-07-20 12:01:36
|