Documentation
¶
Overview ¶
Package fontconfig provides a way to list the fonts of a system and to query the best match with user defined criteria.
This package is a port of the C library.
Index ¶
- Constants
- Variables
- func DefaultFontDirs() ([]string, error)
- func FT_Get_Advance(face FT_Face, glyph fonts.GID, loadFlags LoadFlags) (int32, bool)
- func FT_Get_MM_Var(face FT_Face) *truetype.TableFvar
- func FT_Select_Charmap(face FT_Face, enc int) truetype.Cmap
- func FT_Select_Size(face FT_Face, strikeIndex int)
- func FT_Set_Var_Design_Coordinates(face FT_Face, id int, coors []float64)
- func WeightFromOT(otWeight float64) float64
- func WeightToOT(fcWeight float64) float64
- type Bool
- type Charset
- func (fcs *Charset) AddChar(r rune)
- func (fcs Charset) Copy() Charset
- func (fcs Charset) DelChar(r rune)
- func (c *Charset) GobDecode(data []byte) error
- func (c Charset) GobEncode() ([]byte, error)
- func (fcs *Charset) HasChar(r rune) bool
- func (s Charset) Hash() []byte
- func (s Charset) String() string
- type Config
- func (config *Config) LoadFromDir(dir string) error
- func (config *Config) LoadFromMemory(r io.Reader) error
- func (config *Config) PrepareRender(pat, font Pattern) Pattern
- func (config *Config) ScanFontDirectories(dirs ...string) (Fontset, error)
- func (config *Config) ScanFontFile(path string) (Fontset, error)
- func (config *Config) ScanFontRessource(content fonts.Resource, contentID string) (Fontset, error)
- func (config *Config) Substitute(p, testPattern Pattern, kind matchKind)
- type FT_Face
- type FT_Glyph_Format
- type FT_Outline
- type Float
- type FontFormat
- type Fontset
- type GlyphMetric
- type Hasher
- type Int
- type Langset
- type LoadFlags
- type Matrix
- type Object
- type Pattern
- func (p Pattern) Add(object Object, value Value, appendMode bool)
- func (p Pattern) AddBool(object Object, value bool)
- func (p Pattern) AddFloat(object Object, value float64)
- func (p Pattern) AddInteger(object Object, value int)
- func (p Pattern) AddList(object Object, list valueList, appendMode bool)
- func (p Pattern) AddString(object Object, value string)
- func (p Pattern) Del(object Object)
- func (p Pattern) Duplicate() Pattern
- func (p Pattern) Format() FontFormat
- func (p Pattern) GetAt(object Object, id int) (Value, Result)
- func (p Pattern) GetAtString(object Object, id int) (string, Result)
- func (p Pattern) GetBool(object Object) (Bool, bool)
- func (p Pattern) GetCharset(object Object) (Charset, bool)
- func (p Pattern) GetFloat(object Object) (float64, bool)
- func (p Pattern) GetFloats(object Object) []float64
- func (p Pattern) GetInt(object Object) (int, bool)
- func (p Pattern) GetInts(object Object) []int
- func (p Pattern) GetMatrices(object Object) []Matrix
- func (p Pattern) GetMatrix(object Object) (Matrix, bool)
- func (p Pattern) GetString(object Object) (string, bool)
- func (p Pattern) GetStrings(object Object) []string
- func (p Pattern) Hash() string
- func (p Pattern) String() string
- func (pattern Pattern) SubstituteDefault()
- type PatternElement
- type Range
- type Result
- type String
- type Value
- type ValueBinding
Examples ¶
Constants ¶
const ( SLANT_ROMAN = 0 SLANT_ITALIC = 100 SLANT_OBLIQUE = 110 WIDTH_ULTRACONDENSED = 50 WIDTH_EXTRACONDENSED = 63 WIDTH_CONDENSED = 75 WIDTH_SEMICONDENSED = 87 WIDTH_NORMAL = 100 WIDTH_SEMIEXPANDED = 113 WIDTH_EXPANDED = 125 WIDTH_EXTRAEXPANDED = 150 WIDTH_ULTRAEXPANDED = 200 PROPORTIONAL = 0 DUAL = 90 MONO = 100 CHARCELL = 110 /* sub-pixel order */ RGBA_UNKNOWN = 0 RGBA_RGB = 1 RGBA_BGR = 2 RGBA_VRGB = 3 RGBA_VBGR = 4 RGBA_NONE = 5 /* hinting style */ HINT_NONE = 0 HINT_SLIGHT = 1 HINT_MEDIUM = 2 HINT_FULL = 3 /* LCD filter */ LCD_NONE = 0 LCD_DEFAULT = 1 LCD_LIGHT = 2 LCD_LEGACY = 3 )
const ( WEIGHT_THIN = 0 WEIGHT_EXTRALIGHT = 40 WEIGHT_ULTRALIGHT = WEIGHT_EXTRALIGHT WEIGHT_LIGHT = 50 WEIGHT_DEMILIGHT = 55 WEIGHT_SEMILIGHT = WEIGHT_DEMILIGHT WEIGHT_BOOK = 75 WEIGHT_REGULAR = 80 WEIGHT_NORMAL = WEIGHT_REGULAR WEIGHT_MEDIUM = 100 WEIGHT_DEMIBOLD = 180 WEIGHT_SEMIBOLD = WEIGHT_DEMIBOLD WEIGHT_BOLD = 200 WEIGHT_EXTRABOLD = 205 WEIGHT_ULTRABOLD = WEIGHT_EXTRABOLD WEIGHT_BLACK = 210 WEIGHT_HEAVY = WEIGHT_BLACK WEIGHT_EXTRABLACK = 215 WEIGHT_ULTRABLACK = WEIGHT_EXTRABLACK )
const ( // Rules in the config to apply to the query pattern MatchQuery matchKind // Rules in the config to apply to the fonts // returned as the result of a query MatchResult // Rules in the config to apply to the fonts obtained // during the scan MatchScan )
const ( TT_MAC_LANGID_ENGLISH = iota TT_MAC_LANGID_FRENCH TT_MAC_LANGID_GERMAN TT_MAC_LANGID_ITALIAN TT_MAC_LANGID_DUTCH TT_MAC_LANGID_SWEDISH TT_MAC_LANGID_SPANISH TT_MAC_LANGID_DANISH TT_MAC_LANGID_PORTUGUESE TT_MAC_LANGID_NORWEGIAN TT_MAC_LANGID_HEBREW TT_MAC_LANGID_JAPANESE TT_MAC_LANGID_ARABIC TT_MAC_LANGID_FINNISH TT_MAC_LANGID_GREEK TT_MAC_LANGID_ICELANDIC TT_MAC_LANGID_MALTESE TT_MAC_LANGID_TURKISH TT_MAC_LANGID_CROATIAN TT_MAC_LANGID_CHINESE_TRADITIONAL TT_MAC_LANGID_URDU TT_MAC_LANGID_HINDI TT_MAC_LANGID_THAI TT_MAC_LANGID_KOREAN TT_MAC_LANGID_LITHUANIAN TT_MAC_LANGID_POLISH TT_MAC_LANGID_HUNGARIAN TT_MAC_LANGID_ESTONIAN TT_MAC_LANGID_LETTISH TT_MAC_LANGID_SAAMISK TT_MAC_LANGID_FAEROESE TT_MAC_LANGID_FARSI TT_MAC_LANGID_RUSSIAN TT_MAC_LANGID_CHINESE_SIMPLIFIED TT_MAC_LANGID_FLEMISH TT_MAC_LANGID_IRISH TT_MAC_LANGID_ALBANIAN TT_MAC_LANGID_ROMANIAN TT_MAC_LANGID_CZECH TT_MAC_LANGID_SLOVAK TT_MAC_LANGID_SLOVENIAN TT_MAC_LANGID_YIDDISH TT_MAC_LANGID_SERBIAN TT_MAC_LANGID_MACEDONIAN TT_MAC_LANGID_BULGARIAN TT_MAC_LANGID_UKRAINIAN TT_MAC_LANGID_BYELORUSSIAN TT_MAC_LANGID_UZBEK TT_MAC_LANGID_KAZAKH // TT_MAC_LANGID_AZERBAIJANI TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT TT_MAC_LANGID_ARMENIAN TT_MAC_LANGID_GEORGIAN TT_MAC_LANGID_MOLDAVIAN TT_MAC_LANGID_KIRGHIZ TT_MAC_LANGID_TAJIKI TT_MAC_LANGID_TURKMEN TT_MAC_LANGID_MONGOLIAN // TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT TT_MAC_LANGID_PASHTO TT_MAC_LANGID_KURDISH TT_MAC_LANGID_KASHMIRI TT_MAC_LANGID_SINDHI TT_MAC_LANGID_TIBETAN TT_MAC_LANGID_NEPALI TT_MAC_LANGID_SANSKRIT TT_MAC_LANGID_MARATHI TT_MAC_LANGID_BENGALI TT_MAC_LANGID_ASSAMESE TT_MAC_LANGID_GUJARATI TT_MAC_LANGID_PUNJABI TT_MAC_LANGID_ORIYA TT_MAC_LANGID_MALAYALAM TT_MAC_LANGID_KANNADA TT_MAC_LANGID_TAMIL TT_MAC_LANGID_TELUGU TT_MAC_LANGID_SINHALESE TT_MAC_LANGID_BURMESE TT_MAC_LANGID_KHMER TT_MAC_LANGID_LAO TT_MAC_LANGID_VIETNAMESE TT_MAC_LANGID_INDONESIAN TT_MAC_LANGID_TAGALOG TT_MAC_LANGID_MALAY_ROMAN_SCRIPT TT_MAC_LANGID_MALAY_ARABIC_SCRIPT TT_MAC_LANGID_AMHARIC TT_MAC_LANGID_TIGRINYA TT_MAC_LANGID_GALLA TT_MAC_LANGID_SOMALI TT_MAC_LANGID_SWAHILI TT_MAC_LANGID_RUANDA TT_MAC_LANGID_RUNDI TT_MAC_LANGID_CHEWA TT_MAC_LANGID_MALAGASY TT_MAC_LANGID_ESPERANTO )
const ( TT_MAC_LANGID_WELSH = 128 + iota TT_MAC_LANGID_BASQUE TT_MAC_LANGID_CATALAN TT_MAC_LANGID_LATIN TT_MAC_LANGID_QUECHUA TT_MAC_LANGID_GUARANI TT_MAC_LANGID_AYMARA TT_MAC_LANGID_TATAR TT_MAC_LANGID_UIGHUR TT_MAC_LANGID_DZONGKHA TT_MAC_LANGID_JAVANESE TT_MAC_LANGID_SUNDANESE /* The following codes are new as of 2000-03-10 */ TT_MAC_LANGID_GALICIAN TT_MAC_LANGID_AFRIKAANS TT_MAC_LANGID_BRETON TT_MAC_LANGID_INUKTITUT TT_MAC_LANGID_SCOTTISH_GAELIC TT_MAC_LANGID_MANX_GAELIC TT_MAC_LANGID_IRISH_GAELIC TT_MAC_LANGID_TONGAN TT_MAC_LANGID_GREEK_POLYTONIC TT_MAC_LANGID_GREELANDIC TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT )
const ( TT_MS_LANGID_ARABIC_GENERAL = 0x0001 TT_MS_LANGID_CHINESE_GENERAL = 0x0004 TT_MS_LANGID_ENGLISH_GENERAL = 0x0009 TT_MS_LANGID_FRENCH_WEST_INDIES = 0x1C0C TT_MS_LANGID_FRENCH_REUNION = 0x200C TT_MS_LANGID_FRENCH_CONGO = 0x240C TT_MS_LANGID_FRENCH_SENEGAL = 0x280C TT_MS_LANGID_FRENCH_CAMEROON = 0x2C0C TT_MS_LANGID_FRENCH_COTE_D_IVOIRE = 0x300C TT_MS_LANGID_FRENCH_MALI = 0x340C TT_MS_LANGID_ARABIC_SAUDI_ARABIA = 0x0401 TT_MS_LANGID_ARABIC_IRAQ = 0x0801 TT_MS_LANGID_ARABIC_EGYPT = 0x0C01 TT_MS_LANGID_ARABIC_LIBYA = 0x1001 TT_MS_LANGID_ARABIC_ALGERIA = 0x1401 TT_MS_LANGID_ARABIC_MOROCCO = 0x1801 TT_MS_LANGID_ARABIC_TUNISIA = 0x1C01 TT_MS_LANGID_ARABIC_OMAN = 0x2001 TT_MS_LANGID_ARABIC_YEMEN = 0x2401 TT_MS_LANGID_ARABIC_SYRIA = 0x2801 TT_MS_LANGID_ARABIC_JORDAN = 0x2C01 TT_MS_LANGID_ARABIC_LEBANON = 0x3001 TT_MS_LANGID_ARABIC_KUWAIT = 0x3401 TT_MS_LANGID_ARABIC_UAE = 0x3801 TT_MS_LANGID_ARABIC_BAHRAIN = 0x3C01 TT_MS_LANGID_ARABIC_QATAR = 0x4001 TT_MS_LANGID_BULGARIAN_BULGARIA = 0x0402 TT_MS_LANGID_CATALAN_CATALAN = 0x0403 TT_MS_LANGID_CHINESE_TAIWAN = 0x0404 TT_MS_LANGID_CHINESE_PRC = 0x0804 TT_MS_LANGID_CHINESE_HONG_KONG = 0x0C04 TT_MS_LANGID_CHINESE_SINGAPORE = 0x1004 TT_MS_LANGID_CHINESE_MACAO = 0x1404 TT_MS_LANGID_CZECH_CZECH_REPUBLIC = 0x0405 TT_MS_LANGID_DANISH_DENMARK = 0x0406 TT_MS_LANGID_GERMAN_GERMANY = 0x0407 TT_MS_LANGID_GERMAN_SWITZERLAND = 0x0807 TT_MS_LANGID_GERMAN_AUSTRIA = 0x0C07 TT_MS_LANGID_GERMAN_LUXEMBOURG = 0x1007 TT_MS_LANGID_GERMAN_LIECHTENSTEIN = 0x1407 TT_MS_LANGID_GREEK_GREECE = 0x0408 TT_MS_LANGID_ENGLISH_UNITED_STATES = 0x0409 TT_MS_LANGID_ENGLISH_UNITED_KINGDOM = 0x0809 TT_MS_LANGID_ENGLISH_AUSTRALIA = 0x0C09 TT_MS_LANGID_ENGLISH_CANADA = 0x1009 TT_MS_LANGID_ENGLISH_NEW_ZEALAND = 0x1409 TT_MS_LANGID_ENGLISH_IRELAND = 0x1809 TT_MS_LANGID_ENGLISH_SOUTH_AFRICA = 0x1C09 TT_MS_LANGID_ENGLISH_JAMAICA = 0x2009 TT_MS_LANGID_ENGLISH_CARIBBEAN = 0x2409 TT_MS_LANGID_ENGLISH_BELIZE = 0x2809 TT_MS_LANGID_ENGLISH_TRINIDAD = 0x2C09 TT_MS_LANGID_ENGLISH_ZIMBABWE = 0x3009 TT_MS_LANGID_ENGLISH_PHILIPPINES = 0x3409 TT_MS_LANGID_ENGLISH_HONG_KONG = 0x3C09 TT_MS_LANGID_ENGLISH_INDIA = 0x4009 TT_MS_LANGID_ENGLISH_MALAYSIA = 0x4409 TT_MS_LANGID_ENGLISH_SINGAPORE = 0x4809 TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT = 0x040A TT_MS_LANGID_SPANISH_MEXICO = 0x080A TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT = 0x0C0A TT_MS_LANGID_SPANISH_GUATEMALA = 0x100A TT_MS_LANGID_SPANISH_COSTA_RICA = 0x140A TT_MS_LANGID_SPANISH_PANAMA = 0x180A TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC = 0x1C0A TT_MS_LANGID_SPANISH_VENEZUELA = 0x200A TT_MS_LANGID_SPANISH_COLOMBIA = 0x240A TT_MS_LANGID_SPANISH_PERU = 0x280A TT_MS_LANGID_SPANISH_ARGENTINA = 0x2C0A TT_MS_LANGID_SPANISH_ECUADOR = 0x300A TT_MS_LANGID_SPANISH_CHILE = 0x340A TT_MS_LANGID_SPANISH_URUGUAY = 0x380A TT_MS_LANGID_SPANISH_PARAGUAY = 0x3C0A TT_MS_LANGID_SPANISH_BOLIVIA = 0x400A TT_MS_LANGID_SPANISH_EL_SALVADOR = 0x440A TT_MS_LANGID_SPANISH_HONDURAS = 0x480A TT_MS_LANGID_SPANISH_NICARAGUA = 0x4C0A TT_MS_LANGID_SPANISH_PUERTO_RICO = 0x500A TT_MS_LANGID_SPANISH_UNITED_STATES = 0x540A TT_MS_LANGID_SPANISH_LATIN_AMERICA = 0xE40A TT_MS_LANGID_FRENCH_NORTH_AFRICA = 0xE40C TT_MS_LANGID_FRENCH_MOROCCO = 0x380C TT_MS_LANGID_FRENCH_HAITI = 0x3C0C TT_MS_LANGID_FINNISH_FINLAND = 0x040B TT_MS_LANGID_FRENCH_FRANCE = 0x040C TT_MS_LANGID_FRENCH_BELGIUM = 0x080C TT_MS_LANGID_FRENCH_CANADA = 0x0C0C TT_MS_LANGID_FRENCH_SWITZERLAND = 0x100C TT_MS_LANGID_FRENCH_LUXEMBOURG = 0x140C TT_MS_LANGID_FRENCH_MONACO = 0x180C TT_MS_LANGID_HEBREW_ISRAEL = 0x040D TT_MS_LANGID_HUNGARIAN_HUNGARY = 0x040E TT_MS_LANGID_ICELANDIC_ICELAND = 0x040F TT_MS_LANGID_ITALIAN_ITALY = 0x0410 TT_MS_LANGID_ITALIAN_SWITZERLAND = 0x0810 TT_MS_LANGID_JAPANESE_JAPAN = 0x0411 TT_MS_LANGID_KOREAN_KOREA = 0x0412 TT_MS_LANGID_KOREAN_JOHAB_KOREA = 0x0812 // legacy TT_MS_LANGID_DUTCH_NETHERLANDS = 0x0413 TT_MS_LANGID_DUTCH_BELGIUM = 0x0813 TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL = 0x0414 TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK = 0x0814 TT_MS_LANGID_POLISH_POLAND = 0x0415 TT_MS_LANGID_PORTUGUESE_BRAZIL = 0x0416 TT_MS_LANGID_PORTUGUESE_PORTUGAL = 0x0816 TT_MS_LANGID_ROMANSH_SWITZERLAND = 0x0417 TT_MS_LANGID_ROMANIAN_ROMANIA = 0x0418 TT_MS_LANGID_MOLDAVIAN_MOLDAVIA = 0x0818 // legacy TT_MS_LANGID_RUSSIAN_MOLDAVIA = 0x0819 // legacy TT_MS_LANGID_RUSSIAN_RUSSIA = 0x0419 TT_MS_LANGID_CROATIAN_CROATIA = 0x041A TT_MS_LANGID_SERBIAN_SERBIA_LATIN = 0x081A TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC = 0x0C1A TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA = 0x101A TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA = 0x141A TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN = 0x181A TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC = 0x1C1A TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC = 0x201A TT_MS_LANGID_URDU_INDIA = 0x0820 TT_MS_LANGID_SLOVAK_SLOVAKIA = 0x041B TT_MS_LANGID_ALBANIAN_ALBANIA = 0x041C TT_MS_LANGID_SWEDISH_SWEDEN = 0x041D TT_MS_LANGID_SWEDISH_FINLAND = 0x081D TT_MS_LANGID_THAI_THAILAND = 0x041E TT_MS_LANGID_TURKISH_TURKEY = 0x041F TT_MS_LANGID_URDU_PAKISTAN = 0x0420 TT_MS_LANGID_INDONESIAN_INDONESIA = 0x0421 TT_MS_LANGID_UKRAINIAN_UKRAINE = 0x0422 TT_MS_LANGID_BELARUSIAN_BELARUS = 0x0423 TT_MS_LANGID_SLOVENIAN_SLOVENIA = 0x0424 TT_MS_LANGID_ESTONIAN_ESTONIA = 0x0425 TT_MS_LANGID_LATVIAN_LATVIA = 0x0426 TT_MS_LANGID_LITHUANIAN_LITHUANIA = 0x0427 TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA = 0x0827 // legacy TT_MS_LANGID_TAJIK_TAJIKISTAN = 0x0428 TT_MS_LANGID_YIDDISH_GERMANY = 0x043D TT_MS_LANGID_VIETNAMESE_VIET_NAM = 0x042A TT_MS_LANGID_ARMENIAN_ARMENIA = 0x042B TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN = 0x042C TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC = 0x082C TT_MS_LANGID_BASQUE_BASQUE = 0x042D TT_MS_LANGID_UPPER_SORBIAN_GERMANY = 0x042E TT_MS_LANGID_LOWER_SORBIAN_GERMANY = 0x082E TT_MS_LANGID_MACEDONIAN_MACEDONIA = 0x042F TT_MS_LANGID_SUTU_SOUTH_AFRICA = 0x0430 TT_MS_LANGID_TSONGA_SOUTH_AFRICA = 0x0431 TT_MS_LANGID_SETSWANA_SOUTH_AFRICA = 0x0432 TT_MS_LANGID_VENDA_SOUTH_AFRICA = 0x0433 TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA = 0x0434 TT_MS_LANGID_ISIZULU_SOUTH_AFRICA = 0x0435 TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA = 0x0436 TT_MS_LANGID_GEORGIAN_GEORGIA = 0x0437 TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS = 0x0438 TT_MS_LANGID_HINDI_INDIA = 0x0439 TT_MS_LANGID_MALTESE_MALTA = 0x043A TT_MS_LANGID_SAAMI_LAPONIA = 0x043B TT_MS_LANGID_SAMI_NORTHERN_NORWAY = 0x043B TT_MS_LANGID_SAMI_NORTHERN_SWEDEN = 0x083B TT_MS_LANGID_SAMI_NORTHERN_FINLAND = 0x0C3B TT_MS_LANGID_SAMI_LULE_NORWAY = 0x103B TT_MS_LANGID_SAMI_LULE_SWEDEN = 0x143B TT_MS_LANGID_SAMI_SOUTHERN_NORWAY = 0x183B TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN = 0x1C3B TT_MS_LANGID_SAMI_SKOLT_FINLAND = 0x203B TT_MS_LANGID_SAMI_INARI_FINLAND = 0x243B TT_MS_LANGID_IRISH_GAELIC_IRELAND = 0x043C // legacy TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM = 0x083C // legacy TT_MS_LANGID_IRISH_IRELAND = 0x083C TT_MS_LANGID_MALAY_MALAYSIA = 0x043E TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM = 0x083E TT_MS_LANGID_KAZAKH_KAZAKHSTAN = 0x043F TT_MS_LANGID_KYRGYZ_KYRGYZSTAN = 0x0440 TT_MS_LANGID_KISWAHILI_KENYA = 0x0441 TT_MS_LANGID_TURKMEN_TURKMENISTAN = 0x0442 TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN = 0x0443 TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC = 0x0843 TT_MS_LANGID_TATAR_RUSSIA = 0x0444 TT_MS_LANGID_BENGALI_INDIA = 0x0445 TT_MS_LANGID_BENGALI_BANGLADESH = 0x0845 TT_MS_LANGID_PUNJABI_INDIA = 0x0446 TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN = 0x0846 TT_MS_LANGID_GUJARATI_INDIA = 0x0447 TT_MS_LANGID_ODIA_INDIA = 0x0448 TT_MS_LANGID_TAMIL_INDIA = 0x0449 TT_MS_LANGID_TELUGU_INDIA = 0x044A TT_MS_LANGID_KANNADA_INDIA = 0x044B TT_MS_LANGID_MALAYALAM_INDIA = 0x044C TT_MS_LANGID_ASSAMESE_INDIA = 0x044D TT_MS_LANGID_MARATHI_INDIA = 0x044E TT_MS_LANGID_SANSKRIT_INDIA = 0x044F TT_MS_LANGID_MONGOLIAN_MONGOLIA = 0x0450 TT_MS_LANGID_MONGOLIAN_PRC = 0x0850 TT_MS_LANGID_TIBETAN_PRC = 0x0451 TT_MS_LANGID_DZONGHKA_BHUTAN = 0x0851 TT_MS_LANGID_WELSH_UNITED_KINGDOM = 0x0452 TT_MS_LANGID_KHMER_CAMBODIA = 0x0453 TT_MS_LANGID_LAO_LAOS = 0x0454 TT_MS_LANGID_BURMESE_MYANMAR = 0x0455 TT_MS_LANGID_GALICIAN_GALICIAN = 0x0456 TT_MS_LANGID_MANIPURI_INDIA = 0x0458 TT_MS_LANGID_SINDHI_INDIA = 0x0459 TT_MS_LANGID_KONKANI_INDIA = 0x0457 TT_MS_LANGID_KASHMIRI_PAKISTAN = 0x0460 TT_MS_LANGID_KASHMIRI_SASIA = 0x0860 TT_MS_LANGID_SYRIAC_SYRIA = 0x045A TT_MS_LANGID_SINHALA_SRI_LANKA = 0x045B TT_MS_LANGID_CHEROKEE_UNITED_STATES = 0x045C TT_MS_LANGID_INUKTITUT_CANADA = 0x045D TT_MS_LANGID_INUKTITUT_CANADA_LATIN = 0x085D TT_MS_LANGID_AMHARIC_ETHIOPIA = 0x045E TT_MS_LANGID_TAMAZIGHT_ALGERIA = 0x085F TT_MS_LANGID_NEPALI_NEPAL = 0x0461 TT_MS_LANGID_FRISIAN_NETHERLANDS = 0x0462 TT_MS_LANGID_PASHTO_AFGHANISTAN = 0x0463 TT_MS_LANGID_FILIPINO_PHILIPPINES = 0x0464 TT_MS_LANGID_DHIVEHI_MALDIVES = 0x0465 TT_MS_LANGID_OROMO_ETHIOPIA = 0x0472 TT_MS_LANGID_TIGRIGNA_ETHIOPIA = 0x0473 TT_MS_LANGID_TIGRIGNA_ERYTHREA = 0x0873 TT_MS_LANGID_HAUSA_NIGERIA = 0x0468 TT_MS_LANGID_YORUBA_NIGERIA = 0x046A TT_MS_LANGID_QUECHUA_BOLIVIA = 0x046B TT_MS_LANGID_QUECHUA_ECUADOR = 0x086B TT_MS_LANGID_QUECHUA_PERU = 0x0C6B TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA = 0x046C TT_MS_LANGID_BASHKIR_RUSSIA = 0x046D TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG = 0x046E TT_MS_LANGID_GREENLANDIC_GREENLAND = 0x046F TT_MS_LANGID_IGBO_NIGERIA = 0x0470 TT_MS_LANGID_KANURI_NIGERIA = 0x0471 TT_MS_LANGID_GUARANI_PARAGUAY = 0x0474 TT_MS_LANGID_HAWAIIAN_UNITED_STATES = 0x0475 TT_MS_LANGID_LATIN = 0x0476 TT_MS_LANGID_SOMALI_SOMALIA = 0x0477 TT_MS_LANGID_YI_PRC = 0x0478 TT_MS_LANGID_MAPUDUNGUN_CHILE = 0x047A TT_MS_LANGID_MOHAWK_MOHAWK = 0x047C TT_MS_LANGID_BRETON_FRANCE = 0x047E TT_MS_LANGID_UIGHUR_PRC = 0x0480 TT_MS_LANGID_MAORI_NEW_ZEALAND = 0x0481 TT_MS_LANGID_FARSI_IRAN = 0x0429 TT_MS_LANGID_OCCITAN_FRANCE = 0x0482 TT_MS_LANGID_CORSICAN_FRANCE = 0x0483 TT_MS_LANGID_ALSATIAN_FRANCE = 0x0484 TT_MS_LANGID_YAKUT_RUSSIA = 0x0485 TT_MS_LANGID_KICHE_GUATEMALA = 0x0486 TT_MS_LANGID_KINYARWANDA_RWANDA = 0x0487 TT_MS_LANGID_WOLOF_SENEGAL = 0x0488 TT_MS_LANGID_DARI_AFGHANISTAN = 0x048C TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES = 0x0479 )
const ( EncUnicode = iota EncMsSymbol )
const TT_LANGUAGE_DONT_CARE = 0xffff
Variables ¶
var Identity = Matrix{1, 0, 0, 1}
Functions ¶
func DefaultFontDirs ¶
DefaultFontDirs return the OS-dependent usual directories for fonts, or an error if no one exists.
func FT_Get_Advance ¶
TODO:
func WeightFromOT ¶
WeightFromOT returns a float value to use with `WEIGHT`, from a float in the 1..1000 range, resembling the numbers from OpenType specification's OS/2 usWeight numbers, which are also similar to CSS font-weight numbers. If input is negative, zero, or greater than 1000, returns -1. This function linearly interpolates between various WEIGHT constants. As such, the returned value does not necessarily match any of the predefined constants.
func WeightToOT ¶
WeightToOT is the inverse of `WeightFromOT`. If the input is less than `WEIGHT_THIN` or greater than `WEIGHT_EXTRABLACK`, it returns -1. Otherwise returns a number in the range 1 to 1000.
Types ¶
type Charset ¶
type Charset struct {
// contains filtered or unexported fields
}
Charset is a compact rune set.
Its internal representation is composed of a variable number of 'pages', where each page is a boolean set of size 256, encoding the last byte of a rune. Each rune is then mapped to a page number, defined by it second and third bytes.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds a complete configuration of the library.
This object is used to transform the patterns used in queries and returned as results. It also provides a way to exclude particular files/directories/patterns when scanning the available fonts.
A configuration is constructed from XML data structures, with the `LoadFromMemory` and `LoadFromDir` methods. The 'standard' default configuration is provided in the 'confs/' directory.
Example ¶
c := NewConfig()
if err := c.LoadFromDir("confs"); err != nil {
log.Fatal(err)
}
fontDirs, err := DefaultFontDirs()
if err != nil {
log.Fatal(err)
}
_, err = c.ScanFontDirectories(fontDirs...)
if err != nil {
log.Fatal(err)
}
fmt.Println("success")
Output: success
func (*Config) LoadFromDir ¶
LoadFromDir scans this directory, loading all files of the form [0-9]*.conf, and recurse through the subdirectories. It may be used with the included folder 'confs/' to build a 'standard' configuration. See `LoadFromMemory` if you want control over individual files.
func (*Config) LoadFromMemory ¶
Walks the configuration in `r` and constructs the internal representation in `config`. The new rules are added to the configuration, meaning that several file can be merged by repeated calls.
func (*Config) PrepareRender ¶
PrepareRender creates a new pattern consisting of elements of `font` not appearing in `pat`, elements of `pat` not appearing in `font` and the best matching value from `pat` for elements appearing in both. The result is passed to `config.Substitute` with `kind = MatchResult` and then returned.
func (*Config) ScanFontDirectories ¶
ScanFontDirectories recursively scans the given directories, opening the valid font files and building the associated font patterns. Symbolic links for files are resolved, but not for directories. The rules with kind `MatchScan` in `config` are applied to the results. The <selectfont> rules defined in the configuration are applied to filter the returned set. An error is returned if the directory traversal fails, not for invalid font files, which are simply ignored.
func (*Config) ScanFontFile ¶
ScanFontFile scans one font file (see ScanFontDirectories for more details). Here, an error is returned for an invalid font file. Note that only the pattern-based font selector specified in the config (if any), are applied.
func (*Config) ScanFontRessource ¶
ScanFontRessource is the same as `ScanFontFile`, for general content. `contentID` is included in the returned patterns as the file name.
func (*Config) Substitute ¶
Substitute performs the sequence of pattern modification operations on `p`. If `kind` is MatchQuery, then those tagged as pattern operations are applied, else if `kind` is MatchResult, those tagged as font operations are applied and `testPattern` is used for <test> elements with target=pattern.
type FT_Glyph_Format ¶
type FT_Glyph_Format uint8
const ( FT_GLYPH_FORMAT_NONE FT_Glyph_Format = iota FT_GLYPH_FORMAT_COMPOSITE FT_GLYPH_FORMAT_BITMAP FT_GLYPH_FORMAT_OUTLINE FT_GLYPH_FORMAT_PLOTTER )
type FT_Outline ¶
type FT_Outline struct {
// contains filtered or unexported fields
}
type FontFormat ¶
type FontFormat string
const ( TrueType FontFormat = "TrueType" PCF FontFormat = "PCF" Type1 FontFormat = "Type 1" CFF FontFormat = "CFF" )
func (FontFormat) Loader ¶
func (ff FontFormat) Loader() fonts.FontLoader
Loader returns the loader for the font format.
type Fontset ¶
type Fontset []Pattern
Fontset contains a list of Patterns, containing the results of listing fonts. The order within the set does not determine the font selection, except in the case of identical matches in which case earlier fonts match preferrentially.
func LoadFontset ¶
LoadFontset reads a cache file, exported by the `Fontset.Serialize` method, and constructs the associated font set.
func (Fontset) List ¶
List selects fonts matching `p` (all if p is empty), creates patterns from those fonts containing only the objects in `objs` and returns the set of unique such patterns. If no objects are specified, default to all builtin objects.
func (Fontset) Match ¶
Match finds the font in `set` most closely matching `pattern` and returns the result of `config.PrepareRender` for that font and the provided pattern. This function should be called only after `config.Substitute` and `p.SubstituteDefault` have been called for `p`; otherwise the results will not be correct.
func (Fontset) Serialize ¶
Serialize serialise the content of the font set (using gob and gzip). Since scanning the fonts is rather slow, this methods can be used in conjonction with `LoadFontset` to cache the result of a scan.
func (Fontset) Sort ¶
Sort returns the list of fonts from `set` sorted by closeness to `pattern`. If `trim` is true, elements in the list which don't include Unicode coverage not provided by earlier elements in the list are elided. The union of Unicode coverage of all of the fonts is returned. This function should be called only after `Config.Substitute` and `Pattern.SubstituteDefault` have been called for `p`; otherwise the results will not be correct. The returned `Fontset` references Pattern structures which may be shared by the return value from multiple `Sort` calls, applications cannot modify these patterns. Instead, they should be passed, along with `p`, to `Config.PrepareRender()` which combines them into a complete pattern.
type GlyphMetric ¶
type GlyphMetric struct {
// contains filtered or unexported fields
}
func FT_Load_Glyph ¶
func FT_Load_Glyph(face FT_Face, glyph fonts.GID, loadFlags LoadFlags) *GlyphMetric
TODO:
type Hasher ¶
type Hasher interface {
Hash() []byte
}
Hasher may be implemented by complex value types, for which a custom hash is needed, beyong their string representation. The hash must entirely define the object: same hash means same values. See `Pattern.Hash` for more details.
type Langset ¶
type Langset struct {
// contains filtered or unexported fields
}
Langset holds the set of languages supported by a font. These are computed for a font based on orthographic information built into the fontconfig library. Fontconfig has orthographies for all of the ISO 639-1 languages except for MS, NA, PA, PS, QU, RN, RW, SD, SG, SN, SU and ZA.
type LoadFlags ¶
type LoadFlags uint32
const ( FT_LOAD_DEFAULT LoadFlags = 0x0 FT_LOAD_NO_SCALE LoadFlags = 1 << iota FT_LOAD_NO_HINTING FT_LOAD_RENDER FT_LOAD_NO_BITMAP FT_LOAD_VERTICAL_LAYOUT FT_LOAD_FORCE_AUTOHINT FT_LOAD_CROP_BITMAP FT_LOAD_PEDANTIC FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH FT_LOAD_NO_RECURSE FT_LOAD_IGNORE_TRANSFORM FT_LOAD_MONOCHROME FT_LOAD_LINEAR_DESIGN FT_LOAD_NO_AUTOHINT /* Bits 16-19 are used by `FT_LOAD_TARGET_` */ FT_LOAD_COLOR FT_LOAD_COMPUTE_METRICS FT_LOAD_BITMAP_METRICS_ONLY )
type Object ¶
type Object uint16
Object encode the propery of a font. Standard properties are builtin the pacakge, but custom ones may also be integrated inside patterns
const ( FAMILY Object // String FAMILYLANG // String STYLE // String STYLELANG // String FULLNAME // String FULLNAMELANG // String SLANT // Integer WEIGHT // Range WIDTH // Range SIZE // Range ASPECT // Double PIXEL_SIZE // Double SPACING // Integer FOUNDRY // String ANTIALIAS // Bool HINT_STYLE // Integer HINTING // Bool VERTICAL_LAYOUT // Bool AUTOHINT // Bool GLOBAL_ADVANCE // Bool FILE // String INDEX // Integer RASTERIZER // String OUTLINE // Bool SCALABLE // Bool DPI // Double RGBA // Integer SCALE // Double MINSPACE // Bool CHARWIDTH // Integer CHAR_HEIGHT // Integer MATRIX // Matrix CHARSET // CharSet LANG // LangSet FONTVERSION // Integer CAPABILITY // String FONTFORMAT // String EMBOLDEN // Bool EMBEDDED_BITMAP // Bool DECORATIVE // Bool LCD_FILTER // Integer NAMELANG // String FONT_FEATURES // String PRGNAME // String HASH // String POSTSCRIPT_NAME // String COLOR // Bool SYMBOL // Bool FONT_VARIATIONS // String VARIABLE // Bool FONT_HAS_HINT // Bool ORDER // Integer // Custom objects should be defined starting from this value FirstCustomObject )
func FromString ¶
FromString lookup an object from its string value, both for builtin and custom objects. The zero value is returned for unknown objects.
type Pattern ¶
type Pattern map[Object]*valueList
An Pattern holds a set of names with associated value lists; each name refers to a property of a font, also called `Object`. Patterns are used as inputs to the matching code as well as holding information about specific fonts. Each property can hold one or more values; conventionally all of the same type, although the interface doesn't demand that.
func BuildPattern ¶
func BuildPattern(elements ...PatternElement) Pattern
func (Pattern) Add ¶
Add adds the given value for the given object, with a strong binding. `appendMode` controls the location of insertion in the current list. A copy of `value` is made, so that the library retains no reference to any user-supplied data.
func (Pattern) AddInteger ¶
func (Pattern) AddList ¶
Add adds the given list of values for the given object. `appendMode` controls the location of insertion in the current list.
func (Pattern) Duplicate ¶
Duplicate returns a new pattern that matches `p`. Each pattern may be modified without affecting the other.
func (Pattern) Format ¶
func (p Pattern) Format() FontFormat
Format returns the font format of this pattern.
func (Pattern) GetAt ¶
GetAt returns the value in position `id` for `object`, without type conversion.
func (Pattern) GetCharset ¶
GetCharset return the potential Charset at `object`, index 0, if any.
func (Pattern) GetMatrices ¶
GetMatrices returns the values with type FcMatrix at `object`
func (Pattern) GetStrings ¶
GetStrings returns the values with type String at `object`
func (Pattern) Hash ¶
Hash returns a value, usable as map key, and defining the pattern in terms of equality: two patterns with the same hash are considered equal.
func (Pattern) SubstituteDefault ¶
func (pattern Pattern) SubstituteDefault()
SubstituteDefault performs default substitutions in a pattern, supplying default values for underspecified font patterns:
- unspecified style or weight are set to Medium
- unspecified style or slant are set to Roman
- unspecified pixel size are given one computed from any specified point size (default 12), dpi (default 75) and scale (default 1).
type PatternElement ¶
type Value ¶
type Value interface {
// contains filtered or unexported methods
}
Value is a sum type for the values of the properties of a pattern
type ValueBinding ¶
type ValueBinding uint8
const ( ValueBindingWeak ValueBinding = iota ValueBindingStrong ValueBindingSame )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Read a set of language orthographies and build C declarations for charsets which can then be used to identify which languages are supported by a given font.
|
Read a set of language orthographies and build C declarations for charsets which can then be used to identify which languages are supported by a given font. |