Skip to content
This repository was archived by the owner on Dec 31, 2022. It is now read-only.

Commit 0a57f07

Browse files
committed
Add Font::FontSize() as well
1 parent 0c2a8c6 commit 0a57f07

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Font.go

+5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ func (font Font) handle() C.IggFont {
4747
return C.IggFont(font)
4848
}
4949

50+
// FontSize returns the height of the given font.
51+
func (font Font) FontSize() float32 {
52+
return float32(C.iggFontFontSize(font.handle()))
53+
}
54+
5055
// FindGlyph returns the FontGlyph corresponding to the given rune.
5156
func (font Font) FindGlyph(ch rune) FontGlyph {
5257
return FontGlyph(C.iggFindGlyph(font.handle(), C.int(ch)))

wrapper/Font.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ void iggCalcTextSize(const char *text, int length, IggBool hide_text_after_doubl
2323
exportValue(*value, ImGui::CalcTextSize(text, text + length, hide_text_after_double_hash, wrap_width));
2424
}
2525

26+
float iggFontFontSize(IggFont handle)
27+
{
28+
ImFont *font = reinterpret_cast<ImFont *>(handle);
29+
return font->FontSize;
30+
}
31+
2632
IggFontGlyph iggFindGlyph(IggFont handle, int ch)
2733
{
2834
ImFont *font = reinterpret_cast<ImFont *>(handle);

wrapper/Font.h

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ extern void iggPushFont(IggFont handle);
1010
extern void iggPopFont(void);
1111
extern void iggCalcTextSize(const char *text, int length, IggBool hide_text_after_double_hash, float wrap_width, IggVec2 *value);
1212
extern float iggGetFontSize();
13+
extern float iggFontFontSize(IggFont handle);
1314
extern IggFontGlyph iggFindGlyph(IggFont font, int ch);
1415
extern int iggFontGlyphColored(IggFontGlyph glyph);
1516
extern int iggFontGlyphVisible(IggFontGlyph glyph);

0 commit comments

Comments
 (0)