@@ -1670,11 +1670,11 @@ void GraphicsContextRenderer::restore_region(Region& region)
1670
1670
1671
1671
MathtextBackend::Glyph::Glyph (
1672
1672
std::string path, double size,
1673
- std::variant<char32_t , std::string, FT_ULong> codepoint_or_name_or_index ,
1673
+ std::variant<char32_t , FT_ULong> codepoint_or_index ,
1674
1674
double x, double y,
1675
1675
double slant, double extend) :
1676
1676
path{path}, size{size},
1677
- codepoint_or_name_or_index{codepoint_or_name_or_index },
1677
+ codepoint_or_index{codepoint_or_index },
1678
1678
x{x}, y{y},
1679
1679
slant{slant}, extend{extend}
1680
1680
{}
@@ -1689,16 +1689,9 @@ void MathtextBackend::add_glyph(
1689
1689
1690
1690
void MathtextBackend::add_usetex_glyph (
1691
1691
double ox, double oy, std::string filename, double size,
1692
- std::variant<std::string, FT_ULong> name_or_index,
1693
- double slant, double extend)
1692
+ FT_ULong index, double slant, double extend)
1694
1693
{
1695
- auto codepoint_or_name_or_index =
1696
- std::variant<char32_t , std::string, FT_ULong>{};
1697
- std::visit (
1698
- [&](auto name_or_index) { codepoint_or_name_or_index = name_or_index; },
1699
- name_or_index);
1700
- glyphs_.emplace_back (
1701
- filename, size, codepoint_or_name_or_index, ox, oy, slant, extend);
1694
+ glyphs_.emplace_back (filename, size, index, ox, oy, slant, extend);
1702
1695
}
1703
1696
1704
1697
void MathtextBackend::add_rect (
@@ -1746,37 +1739,16 @@ void MathtextBackend::draw(
1746
1739
}
1747
1740
return FT_Get_Char_Index (ft_face, codepoint);
1748
1741
},
1749
- [&](std::string name) {
1750
- return FT_Get_Name_Index (ft_face, name.data ());
1751
- },
1752
1742
[&](FT_ULong idx) {
1753
- // For classic fonts, the index maps to the "native" font charmap,
1754
- // which typically has an ADOBE_STANDARD or ADOBE_CUSTOM encoding,
1755
- // unlike the FreeType-synthesized one which has a UNICODE encoding.
1756
- auto found = false ;
1757
- for (auto i = 0 ; i < ft_face->num_charmaps ; ++i) {
1758
- auto const & cmap = ft_face->charmaps [i];
1759
- if (cmap->encoding == FT_ENCODING_ADOBE_STANDARD
1760
- || cmap->encoding == FT_ENCODING_ADOBE_CUSTOM) {
1761
- if (found) {
1762
- throw std::runtime_error{" multiple Adobe charmaps found" };
1763
- }
1764
- FT_CHECK (FT_Set_Charmap, ft_face, cmap);
1765
- found = true ;
1766
- }
1767
- }
1768
- if (!found) {
1769
- throw std::runtime_error{" no builtin charmap found" };
1770
- }
1771
- return FT_Get_Char_Index (ft_face, idx);
1743
+ return FT_UInt (idx);
1772
1744
}
1773
- }, glyph.codepoint_or_name_or_index );
1745
+ }, glyph.codepoint_or_index );
1774
1746
if (!index) {
1775
1747
auto glyph_ref = std::visit (overloaded {
1776
1748
[&](char32_t codepoint) { return " #" + std::to_string (codepoint); },
1777
1749
[&](std::string name) { return name; },
1778
1750
[&](FT_ULong idx) { return " #" + std::to_string (idx); }
1779
- }, glyph.codepoint_or_name_or_index );
1751
+ }, glyph.codepoint_or_index );
1780
1752
warn_on_missing_glyph (glyph_ref);
1781
1753
}
1782
1754
auto const & raw_glyph = cairo_glyph_t {index, glyph.x , glyph.y };
0 commit comments