@@ -1767,11 +1767,11 @@ void GraphicsContextRenderer::restore_region(Region& region)
1767
1767
1768
1768
MathtextBackend::Glyph::Glyph (
1769
1769
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 ,
1771
1771
double x, double y,
1772
1772
double slant, double extend ) :
1773
1773
path{path}, size{size},
1774
- codepoint_or_name_or_index{codepoint_or_name_or_index },
1774
+ codepoint_or_index{codepoint_or_index },
1775
1775
x{x}, y{y},
1776
1776
slant{slant}, extend {extend }
1777
1777
{}
@@ -1786,16 +1786,9 @@ void MathtextBackend::add_glyph(
1786
1786
1787
1787
void MathtextBackend::add_usetex_glyph (
1788
1788
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 )
1791
1790
{
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 );
1799
1792
}
1800
1793
1801
1794
void MathtextBackend::add_rect (
@@ -1843,37 +1836,16 @@ void MathtextBackend::draw(
1843
1836
}
1844
1837
return FT_Get_Char_Index (ft_face, codepoint);
1845
1838
},
1846
- [&](std::string name) {
1847
- return FT_Get_Name_Index (ft_face, name.data ());
1848
- },
1849
1839
[&](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);
1869
1841
}
1870
- }, glyph.codepoint_or_name_or_index );
1842
+ }, glyph.codepoint_or_index );
1871
1843
if (!index ) {
1872
1844
auto glyph_ref = std::visit (overloaded {
1873
1845
[&](char32_t codepoint) { return " #" + std::to_string (codepoint); },
1874
1846
[&](std::string name) { return name; },
1875
1847
[&](FT_ULong idx) { return " #" + std::to_string (idx); }
1876
- }, glyph.codepoint_or_name_or_index );
1848
+ }, glyph.codepoint_or_index );
1877
1849
warn_on_missing_glyph (glyph_ref);
1878
1850
}
1879
1851
auto const & raw_glyph = cairo_glyph_t {index , glyph.x , glyph.y };
0 commit comments