os.font #
Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file.
fn default #
@[manualfree]
fn default() string
default returns an absolute path to a readable default font. Search order:
- The env variable
VUI_FONT. - A user-provided fallback font under
${os.config_dir()}/v/fonts. - Platform defaults and
fc-match. - Bundled fonts under
@VEXEROOT/examples/assets/fonts. NOTE that, in some cases, the function calls out to external OS programs so running this in a hot loop is not advised.
fn get_path_variant #
@[manualfree]
fn get_path_variant(font_path string, variant Variant) string
get_path_variant returns the font_path file name replaced with the file name of the font's variant version if it exists.
fn Variant.from #
fn Variant.from[W](input W) !Variant
from returns the Variant value of an integer or of a field name, or an error if there is none.
enum Variant #
enum Variant {
normal = 0
bold
mono
italic
}
Variant enumerates the different variants a font can have.