summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp')
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp
index 23c99e3bc57..74f1b510cbe 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Font.hpp
@@ -2,7 +2,7 @@
** Font.hpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2022 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2023 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -50,7 +50,7 @@ struct GlyphMetrics {
double wl, wr, h, d;
};
-class FontVisitor;
+struct FontVisitor;
/** Abstract base for all font classes. */
class Font {
@@ -124,7 +124,7 @@ class PhysicalFont : public virtual Font {
virtual bool getExactGlyphBox (int c, BoundingBox &bbox, GFGlyphTracer::Callback *cb) const;
virtual bool getExactGlyphBox (int c, GlyphMetrics &metrics, bool vertical, GFGlyphTracer::Callback *cb) const;
virtual bool isCIDFont () const;
- virtual int hAdvance () const;
+ virtual int hAverageAdvance () const;
virtual std::string familyName () const;
virtual std::string styleName () const;
virtual double hAdvance (int c) const;
@@ -139,6 +139,7 @@ class PhysicalFont : public virtual Font {
virtual CharMapID getCharMapID () const =0;
virtual void setCharMapID (const CharMapID &id) {}
virtual Character decodeChar (uint32_t c) const;
+ virtual int charIndexByName (const std::string &charname) const;
const char* path () const override;
void visit (FontVisitor &visitor) override;
void visit (FontVisitor &visitor) const override;
@@ -270,16 +271,20 @@ class NativeFont : public PhysicalFont {
std::unique_ptr<Font> clone (double ds, double sc) const override =0;
std::string name () const override;
Type type () const override;
- double designSize () const override {return _ptsize;}
- double scaledSize () const override {return _ptsize;}
+ const NativeFont* uniqueFont () const override {return this;}
+ double designSize () const override {return _ptsize;}
+ double scaledSize () const override {return _ptsize;}
double charWidth (int c) const override;
double charDepth (int c) const override;
double charHeight (int c) const override;
double italicCorr (int c) const override;
+ virtual double hAdvance (Character c) const;
+ virtual double vAdvance (Character c) const;
const FontMetrics* getMetrics () const override {return nullptr;}
const FontStyle* style () const override {return &_style;}
Color color () const override {return _color;}
const FontMap::Entry* fontMapEntry () const override {return nullptr;}
+ virtual void mapCharToUnicode (uint32_t c, uint32_t codepoint) =0;
static std::string uniqueName (const std::string &path, const FontStyle &style);
void visit (FontVisitor &visitor) override;
void visit (FontVisitor &visitor) const override;
@@ -305,12 +310,18 @@ class NativeFontProxy : public NativeFont {
return std::unique_ptr<NativeFontProxy>(new NativeFontProxy(this , sc, *style(), color()));
}
- const Font* uniqueFont () const override {return _nfont;}
+ const NativeFont* uniqueFont () const override {return _nfont;}
const char* path () const override {return _nfont->path();}
int fontIndex () const override {return _nfont->fontIndex();}
Character decodeChar (uint32_t c) const override {return _nfont->decodeChar(c);}
uint32_t unicode (uint32_t c) const override {return _nfont->unicode(c);}
CharMapID getCharMapID () const override {return _nfont->getCharMapID();}
+ bool verticalLayout() const override {return _nfont->verticalLayout();}
+ std::string name () const override {return _nfont->name();}
+
+ void mapCharToUnicode (uint32_t c, uint32_t codepoint) override {
+ const_cast<NativeFont*>(_nfont)->mapCharToUnicode(c, codepoint);
+ }
protected:
NativeFontProxy (const NativeFont *nfont, double ptsize, const FontStyle &style, Color color)
@@ -326,6 +337,8 @@ class NativeFontImpl : public NativeFont {
NativeFontImpl (std::string fname, int fontIndex, double ptsize, const FontStyle &style, Color color)
: NativeFont(ptsize, style, color), _path(std::move(fname)), _fontIndex(fontIndex) {}
+ NativeFontImpl (std::string fname, std::string fontname, double ptsize);
+
std::unique_ptr<NativeFont> clone (double ptsize, const FontStyle &style, Color color) const override {
return std::unique_ptr<NativeFontProxy>(new NativeFontProxy(this, ptsize, style, color));
}
@@ -334,18 +347,20 @@ class NativeFontImpl : public NativeFont {
return std::unique_ptr<NativeFontProxy>(new NativeFontProxy(this , sc, *style(), color()));
}
- const Font* uniqueFont () const override {return this;}
const char* path () const override {return _path.c_str();}
- int fontIndex() const override {return _fontIndex;}
- std::string fontFamily () const;
+ int fontIndex () const override {return _fontIndex;}
+ std::string name () const override {return _name.empty() ? NativeFont::name() : _name;}
bool findAndAssignBaseFontMap () override;
CharMapID getCharMapID () const override {return CharMapID::NONE;}
Character decodeChar (uint32_t c) const override;
uint32_t unicode (uint32_t c) const override;
+ bool verticalLayout() const override;
+ void mapCharToUnicode (uint32_t c, uint32_t codepoint) override;
private:
std::string _path;
- int _fontIndex;
+ std::string _name;
+ int _fontIndex = 0;
ToUnicodeMap _toUnicodeMap; ///< maps from char indexes to unicode points
};