Skip to main content

widget.fonts.cache

local cache = require "widget.fonts.cache"

__index

(field) __index: core.object

building

(field) building: boolean

fontdirs

(field) fontdirs: table<integer, string>

fontinfo

(field) fontinfo: widget.fonts.info

fonts

(field) fonts: widget.fonts.data[]

found

(field) found: integer

found_monospaced

(field) found_monospaced: integer

loaded_fonts

(field) loaded_fonts: table

monospaced

(field) monospaced: boolean

monosppaced

(field) monosppaced: boolean

searching_monospaced

(field) searching_monospaced: boolean

super

(field) super: core.object

__call

(method) core.object:__call(...any)
-> core.object

Metamethod to allow using the object call as a constructor.


__tostring

(method) core.object:__tostring()
-> string

Metamethod to get a string representation of an object.


build

(method) widget.fonts.cache:build()
-> started: boolean

Build the font cache and save it.

@return started — False if cache is already been built


extend

(method) core.object:extend()
-> core.object

extends

(method) core.object:extends(T: any)
-> boolean

Check if the object inherits from the given type.


is

(method) core.object:is(T: any)
-> boolean

Check if the object is strictly of the given type.


is_building

(method) widget.fonts.cache:is_building()
-> building: boolean

Check if the cache is already building.


is_class_of

(method) core.object:is_class_of(T: any)
-> boolean

Check if the parameter is strictly of the object type.


is_extended_by

(method) core.object:is_extended_by(T: any)
-> boolean

Check if the parameter inherits from the object.


load_cache

(method) widget.fonts.cache:load_cache()
-> boolean

Load font cache from persistent file for faster startup time.


new

(method) widget.fonts.cache:new()

Constructor


rebuild

(method) widget.fonts.cache:rebuild()
-> started: boolean

Clear current font cache and rebuild it.

@return started — False if cache is already been built


save_cache

(method) widget.fonts.cache:save_cache()

Store current font cache to persistent file.


scan_dir

(method) widget.fonts.cache:scan_dir(path: string, run_count?: integer)

Scan a directory for valid font files and load them into the cache.


(method) widget.fonts.cache:search(name: string, style?: "Extra bold italic"|"black"|"bold condensed"|"bold italic"|"bold oblique"...(+9), monospaced?: boolean)
-> font_data: (widget.fonts.data)?
2. errmsg: string?

Search for a font and return the best match.

style:
-\> "regular"
| "bold"
| "italic"
| "bold italic"
| "thin"
| "medium"
| "light"
| "black"
| "condensed"
| "oblique"
| "bold oblique"
| "extra nold"
| "Extra bold italic"
| "bold condensed"

verify_monospaced

(method) widget.fonts.cache:verify_monospaced()

Search and mark monospaced fonts on currently loaded cache and save it.