Font

Native font.

Header#include "nativeui/gfx/font.h"
Namespacenamespace nu
Typeclass (RefCounted)

Constructors

Font(const std::string& name, float size, Font::Weight weight, Font::Style style)

Create a Font implementation with the specified name, DIP size, weight and style.

Parameters

Font(const base::FilePath& path, float size)

Create a Font by reading from |path|. If the font file contains multiple families or weights, only the first encountered font will be used.

Parameters

Class methods

Font* Default()

Return the default font used for displaying text.

Return

Font*

Methods

Font* Derive(float size_delta, Font::Weight weight, Font::Style style) const

Returns a new Font derived from the existing font.

The size_delta is the size in DIP to add to the current font.

Parameters

Return

Font*

std::string GetName() const

Return font's family name.

Return

std::string

float GetSize() const

Return font's DIP size.

Return

float

Font::Weight GetWeight() const

Return the font weight.

Return

Font::Weight

Font::Style GetStyle() const

Return the font style.

Return

Font::Style

NativeFont GetNative() const

Return the native instance wrapped by the class.

Return

NativeFont