isl-org / isl-org/Open3D

Using Icon Fonts with gui::Application: example requested

Open
#3,663 0 comments 0 reactions 1 assignee Claimed by @errissa View on GitHub
documentation visualization
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

I see some docs for `FondDescription::AddTypefaceForCodePoints`, but I can't seem to get any icons from fontawesome to render; this is my code so far (assuming I've downloaded fontawesome regular to `/usr/share/fonts/fa-regular-400.ttf`):
````
auto& app = gui::Application::GetInstance();
app.Initialize(argc, argv);
auto default_font = app.GetFontDescriptions()[0];
default_font.AddTypefaceForCodePoints("/usr/share/fonts/fa-regular-400.ttf", std::vector{0xf15b});
app.SetFont(gui::Application::DEFAULT_FONT_ID, default_font);
app.AddWindow(std::make_shared());
app.Run();
````
(There are no errors in loading the font)
In the code for `MyWindow`, I'm trying to create a button to use an icon; I've tried the following, both of which result in a button with `?` as its text instead of the specified icon...
````
auto button = std::make_shared(u8"\uf15b");
...
auto button = std::make_shared("\xef\x85\x9b");
````

I'm not sure what I'm doing wrong here; any help/suggestions are much appreciated.
On that same note, it would be awesome if one of the sample apps used some font-based icons to demonstrate proper usage.
Thanks for this great library!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.