ferroui_base/media/fonts/tables/encoding_ids.rs
1// Derived from SixLabors.Fonts (Apache License 2.0), see NOTICE.md.
2
3/// Encoding IDs.
4///
5/// The value comes straight from font data, so any 16 bit value is
6/// representable; the named values are associated constants.
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Default)]
8pub struct EncodingIDs(pub u16);
9
10#[allow(non_upper_case_globals)]
11impl EncodingIDs {
12 /// Unicode 1.0 semantics.
13 pub const Unicode1: EncodingIDs = EncodingIDs(0);
14 /// Unicode 1.1 semantics.
15 pub const Unicode11: EncodingIDs = EncodingIDs(1);
16 /// ISO/IEC 10646 semantics.
17 pub const ISO10646: EncodingIDs = EncodingIDs(2);
18 /// Unicode 2.0 and onwards semantics, Unicode BMP only (cmap subtable formats 0, 4, 6).
19 pub const Unicode2: EncodingIDs = EncodingIDs(3);
20 /// Unicode 2.0 and onwards semantics, Unicode full repertoire (cmap subtable formats 0, 4, 6, 10, 12).
21 pub const Unicode2Plus: EncodingIDs = EncodingIDs(4);
22 /// Unicode Variation Sequences (cmap subtable format 14).
23 pub const UnicodeVariationSequences: EncodingIDs = EncodingIDs(5);
24 /// Unicode full repertoire (cmap subtable formats 0, 4, 6, 10, 12, 13).
25 pub const UnicodeFull: EncodingIDs = EncodingIDs(6);
26}
27
28impl From<u16> for EncodingIDs {
29 #[inline]
30 fn from(value: u16) -> Self {
31 EncodingIDs(value)
32 }
33}