@@ -1767,11 +1767,11 @@ void GraphicsContextRenderer::restore_region(Region& region)
17671767
17681768MathtextBackend::Glyph::Glyph (
17691769 std::string path, double size,
1770- std::variant<char32_t , std::string, FT_ULong> codepoint_or_name_or_index ,
1770+ std::variant<char32_t , FT_ULong> codepoint_or_index ,
17711771 double x, double y,
17721772 double slant, double extend) :
17731773 path{path}, size{size},
1774- codepoint_or_name_or_index{codepoint_or_name_or_index },
1774+ codepoint_or_index{codepoint_or_index },
17751775 x{x}, y{y},
17761776 slant{slant}, extend{extend}
17771777{}
@@ -1786,16 +1786,9 @@ void MathtextBackend::add_glyph(
17861786
17871787void MathtextBackend::add_usetex_glyph (
17881788 double ox, double oy, std::string filename, double size,
1789- std::variant<std::string, FT_ULong> name_or_index,
1790- double slant, double extend)
1789+ FT_ULong index, double slant, double extend)
17911790{
1792- auto codepoint_or_name_or_index =
1793- std::variant<char32_t , std::string, FT_ULong>{};
1794- std::visit (
1795- [&](auto name_or_index) { codepoint_or_name_or_index = name_or_index; },
1796- name_or_index);
1797- glyphs_.emplace_back (
1798- filename, size, codepoint_or_name_or_index, ox, oy, slant, extend);
1791+ glyphs_.emplace_back (filename, size, index, ox, oy, slant, extend);
17991792}
18001793
18011794void MathtextBackend::add_rect (
@@ -1843,37 +1836,16 @@ void MathtextBackend::draw(
18431836 }
18441837 return FT_Get_Char_Index (ft_face, codepoint);
18451838 },
1846- [&](std::string name) {
1847- return FT_Get_Name_Index (ft_face, name.data ());
1848- },
18491839 [&](FT_ULong idx) {
1850- // For classic fonts, the index maps to the "native" font charmap,
1851- // which typically has an ADOBE_STANDARD or ADOBE_CUSTOM encoding,
1852- // unlike the FreeType-synthesized one which has a UNICODE encoding.
1853- auto found = false ;
1854- for (auto i = 0 ; i < ft_face->num_charmaps ; ++i) {
1855- auto const & cmap = ft_face->charmaps [i];
1856- if (cmap->encoding == FT_ENCODING_ADOBE_STANDARD
1857- || cmap->encoding == FT_ENCODING_ADOBE_CUSTOM) {
1858- if (found) {
1859- throw std::runtime_error{" multiple Adobe charmaps found" };
1860- }
1861- FT_CHECK (FT_Set_Charmap, ft_face, cmap);
1862- found = true ;
1863- }
1864- }
1865- if (!found) {
1866- throw std::runtime_error{" no builtin charmap found" };
1867- }
1868- return FT_Get_Char_Index (ft_face, idx);
1840+ return FT_UInt (idx);
18691841 }
1870- }, glyph.codepoint_or_name_or_index );
1842+ }, glyph.codepoint_or_index );
18711843 if (!index) {
18721844 auto glyph_ref = std::visit (overloaded {
18731845 [&](char32_t codepoint) { return " #" + std::to_string (codepoint); },
18741846 [&](std::string name) { return name; },
18751847 [&](FT_ULong idx) { return " #" + std::to_string (idx); }
1876- }, glyph.codepoint_or_name_or_index );
1848+ }, glyph.codepoint_or_index );
18771849 warn_on_missing_glyph (glyph_ref);
18781850 }
18791851 auto const & raw_glyph = cairo_glyph_t {index, glyph.x , glyph.y };
0 commit comments