Skip to main content

get_encoding

Function get_encoding 

Source
pub fn get_encoding(
    platform_id: u16,
    plat_enc_id: u16,
    lang_id: u16,
) -> Option<&'static str>
Expand description

The Python codec name for an OpenType platformID / platEncID / langID triplet, or None if it is not known (getEncoding).

The names are those fontoxide_encodings::codecs understands.

use fontoxide_misc::encoding_tools::get_encoding;
assert_eq!(get_encoding(3, 1, 0x409), Some("utf_16_be"));
assert_eq!(get_encoding(1, 0, 15), Some("mac_iceland"));
assert_eq!(get_encoding(1, 0, 0), Some("mac_roman"));
assert_eq!(get_encoding(3, 7, 0), None);