summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/src/FontEngine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dviware/dvisvgm/src/FontEngine.cpp')
-rw-r--r--dviware/dvisvgm/src/FontEngine.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/dviware/dvisvgm/src/FontEngine.cpp b/dviware/dvisvgm/src/FontEngine.cpp
index 4a9e9dd955..630570046f 100644
--- a/dviware/dvisvgm/src/FontEngine.cpp
+++ b/dviware/dvisvgm/src/FontEngine.cpp
@@ -2,7 +2,7 @@
** FontEngine.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2022 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 **
@@ -239,6 +239,33 @@ int FontEngine::getVAdvance (const Character &c) const {
}
+int FontEngine::getWidth (const Character &c) const {
+ if (_currentFace) {
+ FT_Load_Glyph(_currentFace, charIndex(c), FT_LOAD_NO_SCALE);
+ return _currentFace->glyph->metrics.width;
+ }
+ return 0;
+}
+
+
+int FontEngine::getHeight (const Character &c) const {
+ if (_currentFace) {
+ FT_Load_Glyph(_currentFace, charIndex(c), FT_LOAD_NO_SCALE);
+ return _currentFace->glyph->metrics.horiBearingY;
+ }
+ return 0;
+}
+
+
+int FontEngine::getDepth (const Character &c) const {
+ if (_currentFace) {
+ FT_Load_Glyph(_currentFace, charIndex(c), FT_LOAD_NO_SCALE);
+ return _currentFace->glyph->metrics.height - _currentFace->glyph->metrics.horiBearingY;
+ }
+ return 0;
+}
+
+
int FontEngine::charIndex (const Character &c) const {
if (!_currentFace || !_currentFace->charmap)
return c.type() == Character::NAME ? 0 : c.number();