Skip to content

Commit

Permalink
Add FindGlyph to Font.
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenDang committed May 13, 2021
1 parent cbc769f commit 5b7a91b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Font.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package imgui

// #include "imguiWrapperTypes.h"
// #include "FontWrapper.h"
import "C"

// Font describes one loaded font in an atlas.
Expand All @@ -13,3 +13,7 @@ const DefaultFont Font = 0
func (font Font) handle() C.IggFont {
return C.IggFont(font)
}

func (font Font) FindGlyph(c rune) C.IggFontGlyph {
return C.iggFontFindGlyph(font.handle(), C.uint(c))
}
8 changes: 8 additions & 0 deletions FontWrapper.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "imguiWrappedHeader.h"
#include "FontWrapper.h"

IggFontGlyph iggFontFindGlyph(IggFont handle, unsigned int c)
{
ImFont *font = reinterpret_cast<ImFont *>(handle);
return static_cast<IggFontGlyph>(const_cast<ImFontGlyph *>(font->FindGlyph(c)));
}
14 changes: 14 additions & 0 deletions FontWrapper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "imguiWrapperTypes.h"

#ifdef __cplusplus
extern "C"
{
#endif

extern IggFontGlyph iggFontFindGlyph(IggFont handle, unsigned int c);

#ifdef __cplusplus
}
#endif
1 change: 1 addition & 0 deletions imguiWrapperTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ typedef void *IggDrawList;
typedef void *IggFontAtlas;
typedef void *IggFontConfig;
typedef void *IggFont;
typedef void *IggFontGlyph;
typedef void *IggGlyphRanges;
typedef void *IggGuiStyle;
typedef void *IggInputTextCallbackData;
Expand Down

0 comments on commit 5b7a91b

Please sign in to comment.