KiCad PCB EDA Suite
Loading...
Searching...
No Matches
font_metrics.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KICAD, a free EDA CAD application.
3 *
4 * Copyright (C) 2021 Ola Rinta-Koski
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef FONT_METRICS_H_
22#define FONT_METRICS_H_
23
24#include <gal/gal.h>
25
26namespace KIFONT
27{
28
30{
31public:
36 double GetOverbarVerticalPosition( double aGlyphHeight ) const
37 {
38 return aGlyphHeight * m_OverbarHeight;
39 }
40
45 double GetUnderlineVerticalPosition( double aGlyphHeight ) const
46 {
47 return aGlyphHeight * m_UnderlineOffset;
48 }
49
50 double GetInterline( double aFontHeight ) const
51 {
52 return aFontHeight * m_InterlinePitch;
53 }
54
55 static const METRICS& Default();
56
57public:
58 double m_InterlinePitch = 1.68;
59 double m_OverbarHeight = 1.23;
60 double m_UnderlineOffset = -0.16;
61};
62
63} // namespace KIFONT
64
65#endif // FONT_METRICS_H_
double GetUnderlineVerticalPosition(double aGlyphHeight) const
Compute the vertical position of an underline.
double m_OverbarHeight
double m_UnderlineOffset
double m_InterlinePitch
double GetOverbarVerticalPosition(double aGlyphHeight) const
Compute the vertical position of an overbar.
double GetInterline(double aFontHeight) const
#define GAL_API
Definition gal.h:27