/*
5 * Authors: see git history
7 * Copyright (C) 2018 Authors
8 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
10#ifndef LIBNRTYPE_FONT_FACTORY_H
11#define LIBNRTYPE_FONT_FACTORY_H
16#include <glibmm/refptr.h>
17#include <pangomm/fontfamily.h>
18#include <pangomm/fontmap.h>
23#include <pango/pango.h>
27#include <pango/pangoft2.h>
50 StyleNames(Glib::ustring cssname, Glib::ustring displayname)
88 std::vector<StyleNames>
GetUIStyles(PangoFontFamily *in);
95 std::shared_ptr<FontInstance>
FaceFromDescr(
char const *family,
char const *style);
_PangoFontDescription PangoFontDescription
An abstract gadget that implements a finite cache for a factory.
std::shared_ptr< FontInstance > FaceFromStyle(SPStyle const *style)
Retrieve a FontInstance from a style object, first trying to use the font-specification,...
std::shared_ptr< FontInstance > FaceFromPangoString(char const *pangoString)
PangoContext * fontContext
PangoFontDescription * parsePostscriptName(std::string const &name, bool substitute)
Use font config to parse the postscript name found in pdf/ps files and return font config family and ...
void AddFontFile(char const *utf8file)
Add a an additional font.
Glib::ustring GetUIFamilyString(PangoFontDescription const *fontDescr)
Returns strings to be used in the UI for family and face (or "style" as the column is labeled)
std::shared_ptr< FontInstance > FaceFromUIStrings(char const *uiFamily, char const *uiStyle)
Glib::ustring ConstructFontSpecification(PangoFontDescription *font)
Constructs a pango string for use with the fontStringMap (see below)
std::shared_ptr< FontInstance > Face(PangoFontDescription *descr, bool canFail=true)
Glib::ustring GetUIStyleString(PangoFontDescription const *fontDescr)
std::vector< std::string > GetAllFontNames()
Returns a list of all font names available in this font config.
Inkscape::Util::cached_map< PangoFontDescription *, FontInstance, Hash, Compare > loaded
std::shared_ptr< FontInstance > FaceFromDescr(char const *family, char const *style)
PangoFontMap * fontServer
std::vector< StyleNames > GetUIStyles(PangoFontFamily *in)
PangoContext * get_font_context() const
void refreshConfig()
The fontsize used as workaround for hinting.
bool hasFontFamily(std::string const &family)
void AddFontsDir(char const *utf8dir)
Add a directory from which to include additional fonts.
std::shared_ptr< FontInstance > FaceFromFontSpecification(char const *fontSpecification)
std::unique_ptr< FontInstance > create_face(PangoFontDescription *descr)
std::vector< Glib::RefPtr< Pango::FontFamily > > get_font_families()
static constexpr double fontSize
std::map< std::string, PangoFontFamily * > GetUIFamilies()
Glib::RefPtr< Pango::FontMap > _font_map
void AddFontFilesWin32(char const *directory_path)
FontInstance provides metrics, OpenType data, and glyph curves/pixbufs for a font.
A cached_map<Tk, Tv> is designed for use by a factory that takes as input keys of type Tk and produce...
PangoFontDescription * ink_font_description_from_style(SPStyle const *style)
char const * sp_font_description_get_family(PangoFontDescription const *fontDescr)
std::string getSubstituteFontName(std::string const &font)
Static objects with destruction before main() exit.
bool operator()(PangoFontDescription const *a, PangoFontDescription const *b) const
size_t operator()(PangoFontDescription const *x) const
Glib::ustring display_name
StyleNames(Glib::ustring name)
StyleNames(Glib::ustring cssname, Glib::ustring displayname)
SPStyle - a style object for SPItem objects.