Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the number of font loading implementations used by this crate #142

Open
notgull opened this issue Jun 18, 2023 · 0 comments
Open

Comments

@notgull
Copy link
Contributor

notgull commented Jun 18, 2023

Excerpt of cargo bloat when run on an example programming containing winit and piet-hardware, which uses cosmic-text for text:

 File  .text    Size                  Crate Name
 0.6%   2.1% 77.7KiB                 x11_dl x11_dl::xlib::Xlib::open::{{closure}}
 0.2%   0.7% 27.8KiB                  swash swash::scale::bitmap::resize
 0.2%   0.6% 23.6KiB                  swash swash::scale::glyf::hint::Hinter::execute
 0.2%   0.6% 22.3KiB                    std addr2line::ResDwarf<R>::parse
 0.2%   0.6% 22.3KiB                  winit winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run
 0.2%   0.5% 20.1KiB                   glow glow::gl46::struct_commands::GlFns::load_all_with_dyn
 0.2%   0.5% 19.9KiB                    std std::backtrace_rs::symbolize::gimli::resolve::{{closure}}
 0.1%   0.5% 17.4KiB                  winit winit::platform_impl::platform::x11::event_processor::EventProcessor<T>::process_event
 0.1%   0.4% 14.8KiB            cosmic_text cosmic_text::shape::ShapeLine::layout
 0.1%   0.4% 14.6KiB                   piet piet::samples::samples_main
 0.1%   0.4% 14.2KiB                    png png::decoder::stream::StreamingDecoder::update
 0.1%   0.3% 13.0KiB            wayland_sys wayland_sys::client::WaylandClient::open
 0.1%   0.3% 13.0KiB             ttf_parser ttf_parser::tables::cff::cff1::_parse_char_string
 0.1%   0.3% 13.0KiB             ttf_parser ttf_parser::tables::cff::cff1::_parse_char_string
 0.1%   0.3% 12.6KiB           glutin_winit glutin_winit::finalize_window
 0.1%   0.3% 12.2KiB                  winit winit::platform_impl::platform::x11::window::UnownedWindow::new
 0.1%   0.3% 11.5KiB             ttf_parser ttf_parser::tables::cff::cff2::_parse_char_string
 0.1%   0.3% 11.5KiB             ttf_parser ttf_parser::tables::cff::cff2::_parse_char_string
 0.1%   0.3% 11.1KiB                  swash swash::scale::cff::cff::Glyph::parse_imp
 0.1%   0.3% 10.8KiB smithay_client_toolkit smithay_client_toolkit::seat::keyboard::ffi::XkbCommon::open

The CFF font parsing tables from ttf_parser add about 50 KiB to the binary while the one that swash uses adds about 12 KiB to the binary. It would be nice if only one instance of the CFF table was present in the final binary.

cc dfrg/swash#36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant