docs
Loading...
Searching...
No Matches
FontFileabstract

#include <Ultralight/platform/FontLoader.h>

Overview

Represents a font file, either on-disk path or in-memory file contents.

Inheritance diagram for FontFile:
RefCounted

Static Public Member Functions

static RefPtr< FontFile > Create (const String &filepath, int face_index=-1)
 Create a font file from an on-disk file path.
static RefPtr< FontFile > Create (RefPtr< Buffer > buffer, int face_index=-1)
 Create a font file from an in-memory buffer.

Public Member Functions

virtual bool is_in_memory () const =0
 Whether or not this font file was created from an in-memory buffer.
virtual String filepath () const =0
 The file path (if any).
virtual RefPtr< Buffer > buffer () const =0
 The in-memory buffer (if any).
virtual int face_index () const =0
 The index of the face within a font collection, or -1 when the library chooses the face.
virtual uint32_t hash () const =0
 Unique hash (if this is a filepath, only the path string is hashed).
Public Member Functions inherited from RefCounted
virtual void AddRef () const =0
 Increment the reference count (thread-safe).
virtual void Release () const =0
 Decrement the reference count (thread-safe).
virtual int ref_count () const =0
 Get the current reference count.
virtual WeakControlBlock * weak_control_block () const
 Get the control block used to track weak references to this object.

Protected Member Functions

 FontFile ()
virtual ~FontFile ()
 FontFile (const FontFile &)
void operator= (const FontFile &)
Protected Member Functions inherited from RefCounted
virtual ~RefCounted ()

Constructor & Destructor Documentation

◆ FontFile() [1/2]

FontFile ( )
protected

◆ ~FontFile()

virtual ~FontFile ( )
protectedvirtual

◆ FontFile() [2/2]

FontFile ( const FontFile & )
protected

Member Function Documentation

◆ buffer()

virtual RefPtr< Buffer > buffer ( ) const
pure virtual

The in-memory buffer (if any).

◆ Create() [1/2]

RefPtr< FontFile > Create ( const String & filepath,
int face_index = -1 )
static

Create a font file from an on-disk file path.

Parameters
filepathThe path to the font file on disk. The file should already exist.
face_indexThe index of the face to use when the file is a font collection (eg, a .ttc holding several families). Pass -1 to let the library choose the face that best matches the requested weight and style.
Returns
Returns a ref-pointer to a new FontFile instance.

◆ Create() [2/2]

RefPtr< FontFile > Create ( RefPtr< Buffer > buffer,
int face_index = -1 )
static

Create a font file from an in-memory buffer.

Parameters
bufferThe font file data (TTF/OTF, or a collection).
face_indexThe index of the face to use when the data is a font collection. Pass -1 to let the library choose the face that best matches the requested weight and style.
Returns
Returns a ref-pointer to a new FontFile instance.

◆ face_index()

virtual int face_index ( ) const
pure virtual

The index of the face within a font collection, or -1 when the library chooses the face.

◆ filepath()

virtual String filepath ( ) const
pure virtual

The file path (if any).

◆ hash()

virtual uint32_t hash ( ) const
pure virtual

Unique hash (if this is a filepath, only the path string is hashed).

◆ is_in_memory()

virtual bool is_in_memory ( ) const
pure virtual

Whether or not this font file was created from an in-memory buffer.

◆ operator=()

void operator= ( const FontFile & )
protected

The documentation for this class was generated from the following file: