typeset 0.1.0
縦書き・横書きの日本語組版ライブラリ(JLReq 水準、ラスタ / PDF / SVG)
読み取り中…
検索中…
一致する文字列を見つけられません
typeset::font::FontSet クラス

#include <typeset/font/font_set.hpp>

公開メンバ関数

 FontSet ()
 
 ~FontSet ()
 
 FontSet (const FontSet &)=delete
 
FontSetoperator= (const FontSet &)=delete
 
std::shared_ptr< glyphware::Face > loadFile (const std::string &path, const std::string &key=std::string(), int faceIndex=0)
 ファイルから開く。key を省略するとパスがキーになる。family / weight / italic は name・OS/2 から
 
std::shared_ptr< glyphware::Face > loadMemory (const std::string &key, const void *data, size_t size, int faceIndex=0)
 メモリから開く(バイト列はコピーして保持する)
 
bool declare (FontDeclaration decl)
 開かずに宣言する。同じキーがあれば置き換える。ファイルは初回使用時に開く(無ければそのとき失敗し、 以後は無いものとして扱う)
 
bool has (const std::string &key) const
 登録済みか(開いているかどうかは問わない)
 
bool isLoaded (const std::string &key) const
 開いているか(declare しただけなら false。開くのに失敗したものも false)
 
std::vector< std::string > keys () const
 登録したキー(登録順)
 
std::shared_ptr< glyphware::Face > find (const std::string &keyOrFamily)
 登録済み face(キー、または family 名で。通常ウェイト・非斜体を優先。無ければ nullptr)。必要なら開く
 
std::shared_ptr< glyphware::Face > select (const std::string &keyOrFamily, int weight, bool italic, const std::map< std::string, float > &variations={})
 キー/family 名と weight / italic に最も近い face。必要なら開く。 バリアブルフォントなら wght 軸を weight に合わせたインスタンス(variations に他の軸も指定できる)
 
std::shared_ptr< glyphware::Face > instance (const std::shared_ptr< glyphware::Face > &base, const std::vector< glyphware::VarCoord > &coords)
 バリアブルフォントのインスタンス(軸の値を固定した別の Face)。同じ base と座標なら同じ Face を返す。 軸の無い face、座標が空ならそのまま base
 
std::shared_ptr< glyphware::Face > resolve (const FontSpec &spec, char32_t cp, const std::string &language=std::string(), int colorPreference=0)
 FontSpec の family 列(language の置換表・宣言の languages が先)を順に見て、cp を持つ最初の face を返す。 family ごとに weight / italic の最近傍を選ぶ。 どれも持たなければ最初に見つかった face(.notdef が出る)。1 つも解決できなければ nullptr
 
std::shared_ptr< glyphware::Face > primary (const FontSpec &spec)
 FontSpec の第一候補(行のメトリクス基準に使う。言語の置換は見ない)
 
void setLanguageFonts (const std::string &language, std::vector< std::string > families)
 言語 → 先に試す family の列。"zh-Hans" のように地域・用字系まで書いた言語は、その完全一致が無ければ 主言語("zh")の表を使う。families が空なら削除
 
std::vector< std::string > languageFonts (const std::string &language) const
 language に対応する family 列(置換表+宣言の languages にその言語を持つキー)。無ければ空
 
hb_font_t * hbFont (const glyphware::Face &face)
 シェイピング用 hb_font(フォントユニットスケール)。FontSet が所有する
 
size_t size () const
 登録した数(宣言だけのものも含む)
 

詳解

font_set.hpp50 行目に定義があります。

構築子と解体子

◆ FontSet() [1/2]

typeset::font::FontSet::FontSet ( )

◆ ~FontSet()

typeset::font::FontSet::~FontSet ( )

◆ FontSet() [2/2]

typeset::font::FontSet::FontSet ( const FontSet )
delete

関数詳解

◆ operator=()

FontSet & typeset::font::FontSet::operator= ( const FontSet )
delete

◆ loadFile()

std::shared_ptr< glyphware::Face > typeset::font::FontSet::loadFile ( const std::string &  path,
const std::string &  key = std::string(),
int  faceIndex = 0 
)

ファイルから開く。key を省略するとパスがキーになる。family / weight / italic は name・OS/2 から

戻り値
失敗時 nullptr

◆ loadMemory()

std::shared_ptr< glyphware::Face > typeset::font::FontSet::loadMemory ( const std::string &  key,
const void *  data,
size_t  size,
int  faceIndex = 0 
)

メモリから開く(バイト列はコピーして保持する)

◆ declare()

bool typeset::font::FontSet::declare ( FontDeclaration  decl)

開かずに宣言する。同じキーがあれば置き換える。ファイルは初回使用時に開く(無ければそのとき失敗し、 以後は無いものとして扱う)

戻り値
キーが空なら false

◆ has()

bool typeset::font::FontSet::has ( const std::string &  key) const

登録済みか(開いているかどうかは問わない)

◆ isLoaded()

bool typeset::font::FontSet::isLoaded ( const std::string &  key) const

開いているか(declare しただけなら false。開くのに失敗したものも false)

◆ keys()

std::vector< std::string > typeset::font::FontSet::keys ( ) const

登録したキー(登録順)

◆ find()

std::shared_ptr< glyphware::Face > typeset::font::FontSet::find ( const std::string &  keyOrFamily)

登録済み face(キー、または family 名で。通常ウェイト・非斜体を優先。無ければ nullptr)。必要なら開く

◆ select()

std::shared_ptr< glyphware::Face > typeset::font::FontSet::select ( const std::string &  keyOrFamily,
int  weight,
bool  italic,
const std::map< std::string, float > &  variations = {} 
)

キー/family 名と weight / italic に最も近い face。必要なら開く。 バリアブルフォントなら wght 軸を weight に合わせたインスタンス(variations に他の軸も指定できる)

◆ instance()

std::shared_ptr< glyphware::Face > typeset::font::FontSet::instance ( const std::shared_ptr< glyphware::Face > &  base,
const std::vector< glyphware::VarCoord > &  coords 
)

バリアブルフォントのインスタンス(軸の値を固定した別の Face)。同じ base と座標なら同じ Face を返す。 軸の無い face、座標が空ならそのまま base

◆ resolve()

std::shared_ptr< glyphware::Face > typeset::font::FontSet::resolve ( const FontSpec spec,
char32_t  cp,
const std::string &  language = std::string(),
int  colorPreference = 0 
)

FontSpec の family 列(language の置換表・宣言の languages が先)を順に見て、cp を持つ最初の face を返す。 family ごとに weight / italic の最近傍を選ぶ。 どれも持たなければ最初に見つかった face(.notdef が出る)。1 つも解決できなければ nullptr

◆ primary()

std::shared_ptr< glyphware::Face > typeset::font::FontSet::primary ( const FontSpec spec)

FontSpec の第一候補(行のメトリクス基準に使う。言語の置換は見ない)

◆ setLanguageFonts()

void typeset::font::FontSet::setLanguageFonts ( const std::string &  language,
std::vector< std::string >  families 
)

言語 → 先に試す family の列。"zh-Hans" のように地域・用字系まで書いた言語は、その完全一致が無ければ 主言語("zh")の表を使う。families が空なら削除

◆ languageFonts()

std::vector< std::string > typeset::font::FontSet::languageFonts ( const std::string &  language) const

language に対応する family 列(置換表+宣言の languages にその言語を持つキー)。無ければ空

◆ hbFont()

hb_font_t * typeset::font::FontSet::hbFont ( const glyphware::Face &  face)

シェイピング用 hb_font(フォントユニットスケール)。FontSet が所有する

◆ size()

size_t typeset::font::FontSet::size ( ) const
inline

登録した数(宣言だけのものも含む)

font_set.hpp126 行目に定義があります。


このクラス詳解は次のファイルから抽出されました: