KiCad PCB EDA Suite
Loading...
Searching...
No Matches
legacy_text_format.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 The KiCad Developers, see AUTHORS.txt for contributors.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include <
eda_text.h
>
23
#include <
font/font.h
>
24
#include <
math/util.h
>
25
26
namespace
KICAD_FORMAT
27
{
28
29
inline
int
GetLegacyTextThickness
(
const
EDA_TEXT
& aText )
30
{
31
const
int
thickness = aText.
GetTextThickness
();
32
33
if
( !aText.
IsBold
() || thickness <= 1 )
34
return
thickness;
35
36
bool
strokeFont =
true
;
37
38
if
(
const
KIFONT::FONT
* font = aText.
GetFont
() )
39
strokeFont = font->IsStroke();
40
else
if
( !aText.
GetUnresolvedFontName
().IsEmpty() )
41
strokeFont =
KIFONT::FONT::IsStroke
( aText.
GetUnresolvedFontName
() );
42
43
return
strokeFont ?
KiROUND
( thickness * 1.6 ) : thickness;
44
}
45
46
}
// namespace KICAD_FORMAT
KiROUND
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition
box2.h:982
EDA_TEXT
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition
eda_text.h:94
EDA_TEXT::GetFont
KIFONT::FONT * GetFont() const
Definition
eda_text.h:286
EDA_TEXT::GetUnresolvedFontName
wxString GetUnresolvedFontName() const
Definition
eda_text.h:289
EDA_TEXT::IsBold
bool IsBold() const
Definition
eda_text.h:215
EDA_TEXT::GetTextThickness
virtual int GetTextThickness() const
Definition
eda_text.h:159
KIFONT::FONT
FONT is an abstract base class for both outline and stroke fonts.
Definition
font.h:94
KIFONT::FONT::IsStroke
virtual bool IsStroke() const
Definition
font.h:101
eda_text.h
font.h
KICAD_FORMAT
Definition
kicad_io_utils.cpp:37
KICAD_FORMAT::GetLegacyTextThickness
int GetLegacyTextThickness(const EDA_TEXT &aText)
Definition
legacy_text_format.h:29
util.h
src
include
io
kicad
legacy_text_format.h
Generated on Sat Oct 10 2026 00:06:44 for KiCad PCB EDA Suite by
1.13.2