23#include <wx/filename.h>
37 fontFile.RemoveLastDir();
38 fontFile.AppendDir( wxT(
"resources" ) );
39 fontFile.AppendDir( wxT(
"fonts" ) );
40 fontFile.SetFullName( aFileName );
42 return fontFile.GetFullPath();
47 const wxString& aFileName )
52 std::vector<wxString> embeddedFonts{ fontPath };
69 wxT(
"symbol_pua_test.ttf" ) );
70 FT_Face face = outline->
GetFace();
78 std::vector<std::unique_ptr<KIFONT::GLYPH>> glyphs;
82 BOOST_REQUIRE_EQUAL( glyphs.size(), 2 );
85 double widthA = glyphs[0]->BoundingBox().GetWidth();
86 double widthB = glyphs[1]->BoundingBox().GetWidth();
88 BOOST_CHECK_GT( widthA, 0.0 );
89 BOOST_CHECK_GT( widthB, 0.0 );
90 BOOST_CHECK_GT( widthA, widthB );
98 wxT(
"NotoSans-Regular.ttf" ) );
99 FT_Face face = outline->
GetFace();
104 BOOST_CHECK( FT_Get_Char_Index( face,
'A' ) != 0 );
115 wxT(
"NotoSans-Regular.ttf" ) );
116 FT_Face face = outline->
GetFace();
120 unsigned int validIndex = FT_Get_Char_Index( face,
'A' );
123 std::vector<KIFONT::CONTOUR> contours;
125 BOOST_CHECK( !contours.empty() );
129 std::vector<KIFONT::CONTOUR> staleContours;
130 BOOST_CHECK( !outline->
LoadGlyphContours( (
unsigned int) face->num_glyphs, staleContours ) );
131 BOOST_CHECK( staleContours.empty() );
143 wxT(
"NotoSans-Regular.ttf" ) );
144 FT_Face face = outline->
GetFace();
147 BOOST_REQUIRE_GT( face->units_per_EM, 0 );
148 BOOST_REQUIRE_GT( face->height, face->units_per_EM );
150 const double glyphHeight = 10000.0;
153 double ratio =
static_cast<double>( face->height ) /
static_cast<double>( face->units_per_EM );
159 BOOST_CHECK_GT( outline->
GetInterline( glyphHeight, metrics ),
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
virtual bool IsOutline() const
double GetInterline(double aFontHeight) const
static const METRICS & Default()
Class OUTLINE_FONT implements outline font drawing.
double GetInterline(double aGlyphHeight, const METRICS &aFontMetrics) const override
Compute the distance (interline) between 2 lines of text (for multiline texts).
bool LoadGlyphContours(unsigned int aGlyphIndex, std::vector< CONTOUR > &aContours) const
Load a single glyph into the shared FreeType slot and decompose its outline into line-chain contours.
VECTOR2I GetTextAsGlyphs(BOX2I *aBoundingBox, std::vector< std::unique_ptr< GLYPH > > *aGlyphs, const wxString &aText, const VECTOR2I &aSize, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle, bool aMirror, const VECTOR2I &aOrigin, TEXT_STYLE_FLAGS aTextStyle) const override
Convert text string to an array of GLYPHs.
const FT_Face & GetFace() const
static constexpr EDA_ANGLE ANGLE_0
std::string GetTestDataRootDir()
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
VECTOR3I expected(15, 30, 45)
static wxString getTestFontPath(const wxString &aFileName)
static KIFONT::OUTLINE_FONT * loadTestOutlineFont(const wxString &aFontName, const wxString &aFileName)
BOOST_AUTO_TEST_CASE(SymbolFontRendersAsciiGlyphs)
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I