Skip to content

Commit

Permalink
Update doc / fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Jan 8, 2024
1 parent 83f7296 commit 5ecdaed
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 25 deletions.
13 changes: 7 additions & 6 deletions docs/book/_sources/doc_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ float EmSize(float nbLines);
See [hello_imgui_font.h](https://github.com/pthom/hello_imgui/blob/master/src/hello_imgui/hello_imgui_font.h).
```cpp
//
// When loading fonts, use HelloImGui::LoadFont(FontLoadingParams)
// ===============================================================
// instead of ImGui::GetIO().Fonts->AddFontFromFileTTF(), because it will
// automatically adjust the font size to account for HighDPI, and will spare
// you headaches when trying to get consistent font size across different OSes.
// When loading fonts, use HelloImGui::LoadFont(fontFilename, fontSize, fontLoadingParams)
//
// Font loading parameters: several options are available (color, merging, range, ...)
struct FontLoadingParams
Expand Down Expand Up @@ -107,7 +103,12 @@ See [hello_imgui_font.h](https://github.com/pthom/hello_imgui/blob/master/src/he
ImFontConfig fontConfigFontAwesome = ImFontConfig();
};
// Generic font loading function, with many options:
// When loading fonts, use HelloImGui::LoadFont(FontLoadingParams)
// ===============================================================
// instead of ImGui::GetIO().Fonts->AddFontFromFileTTF(), because it will
// automatically adjust the font size to account for HighDPI, and will spare
// you headaches when trying to get consistent font size across different OSes.
//
// see FontLoadingParams and ImFontConfig
ImFont* LoadFont(const std::string & fontFilename, float fontSize,
const FontLoadingParams & params = {});
Expand Down
13 changes: 7 additions & 6 deletions docs/book/doc_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,7 @@ <h1>Place widgets in a DPI-aware way<a class="headerlink" href="#place-widgets-i
<h1>Load fonts<a class="headerlink" href="#load-fonts" title="Permalink to this heading">#</a></h1>
<p>See <a class="reference external" href="https://github.com/pthom/hello_imgui/blob/master/src/hello_imgui/hello_imgui_font.h">hello_imgui_font.h</a>.</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="w"> </span><span class="c1">//</span>
<span class="w"> </span><span class="c1">// When loading fonts, use HelloImGui::LoadFont(FontLoadingParams)</span>
<span class="w"> </span><span class="c1">// ===============================================================</span>
<span class="w"> </span><span class="c1">// instead of ImGui::GetIO().Fonts-&gt;AddFontFromFileTTF(), because it will</span>
<span class="w"> </span><span class="c1">// automatically adjust the font size to account for HighDPI, and will spare</span>
<span class="w"> </span><span class="c1">// you headaches when trying to get consistent font size across different OSes.</span>
<span class="w"> </span><span class="c1">// When loading fonts, use HelloImGui::LoadFont(fontFilename, fontSize, fontLoadingParams)</span>
<span class="w"> </span><span class="c1">//</span>
<span class="w"> </span><span class="c1">// Font loading parameters: several options are available (color, merging, range, ...)</span>
<span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc">FontLoadingParams</span>
Expand Down Expand Up @@ -523,7 +519,12 @@ <h1>Load fonts<a class="headerlink" href="#load-fonts" title="Permalink to this
<span class="w"> </span><span class="n">ImFontConfig</span><span class="w"> </span><span class="n">fontConfigFontAwesome</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ImFontConfig</span><span class="p">();</span>
<span class="w"> </span><span class="p">};</span>

<span class="w"> </span><span class="c1">// Generic font loading function, with many options:</span>
<span class="w"> </span><span class="c1">// When loading fonts, use HelloImGui::LoadFont(FontLoadingParams)</span>
<span class="w"> </span><span class="c1">// ===============================================================</span>
<span class="w"> </span><span class="c1">// instead of ImGui::GetIO().Fonts-&gt;AddFontFromFileTTF(), because it will</span>
<span class="w"> </span><span class="c1">// automatically adjust the font size to account for HighDPI, and will spare</span>
<span class="w"> </span><span class="c1">// you headaches when trying to get consistent font size across different OSes.</span>
<span class="w"> </span><span class="c1">//</span>
<span class="w"> </span><span class="c1">// see FontLoadingParams and ImFontConfig</span>
<span class="w"> </span><span class="n">ImFont</span><span class="o">*</span><span class="w"> </span><span class="nf">LoadFont</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="w"> </span><span class="o">&amp;</span><span class="w"> </span><span class="n">fontFilename</span><span class="p">,</span><span class="w"> </span><span class="kt">float</span><span class="w"> </span><span class="n">fontSize</span><span class="p">,</span>
<span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">FontLoadingParams</span><span class="w"> </span><span class="o">&amp;</span><span class="w"> </span><span class="n">params</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{});</span>
Expand Down
Loading

0 comments on commit 5ecdaed

Please sign in to comment.