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

[bug] Multiple fonts / Icon fonts broken since migration #711

Open
Geo5 opened this issue Oct 8, 2023 · 3 comments
Open

[bug] Multiple fonts / Icon fonts broken since migration #711

Geo5 opened this issue Oct 8, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Geo5
Copy link
Contributor

Geo5 commented Oct 8, 2023

Hey,
using icon fonts (and also possibly the MultipleFonts example) seems to be broken since the migration to cimgui-go.

Below is the code example, which correctly displays icons on v0.7.0 but does not work on current master:
Fonts_v0 7 0
Fonts_master

The minimal example uses https://github.com/juliettef/IconFontCppHeaders with forkawesome-webfont.ttf

I could not find any changes, which seemed meaningful to me to FontAtlasProcessor.go since v0.7.0, so maybe it has something to do with cimgui-go itself.

Code example

main.go
package main

import (
	iconFonts "github.com/juliettef/IconFontCppHeaders"

	g "github.com/AllenDang/giu"
)

var IconFont = iconFonts.IconsForkAwesome

func Icon(name string) string {
	ret, ok := IconFont.Icons[name]
	if !ok {
		panic(name + " icon not found")
	}
	return ret
}

func loop() {
	g.SingleWindow().Layout(
		g.Label("Content line"),
		g.Label("Content line "+Icon("Check")),
		g.Button("Normal button"),
		g.Button("Normal button"+Icon("Check")),
	)
}

func main() {
	wnd := g.NewMasterWindow("Multiple fonts and icons", 600, 400, g.MasterWindowFlagsNotResizable)
	// Change the default font to include icons
	g.Context.FontAtlas.SetDefaultFont("forkawesome-webfont.ttf", 20)
	wnd.Run(loop)
}

To Reproduce

  1. Run the demo on master
  2. Run the demo on v0.7.0

Version

master

OS

Linux

@gucio321
Copy link
Collaborator

GlyphRangesBuilder is broken. Refer AllenDang/cimgui-go#206

@gucio321
Copy link
Collaborator

upstream issue closed, @Geo5 there was a large change in the way how cimgui-go wraps imgui types. Could you check if this works now?

@gucio321 gucio321 added the Likely fixed Discussion led to some point; everything seems to be fixed and issue is abandoned. Will close soon. label Feb 17, 2024
@Geo5
Copy link
Contributor Author

Geo5 commented Feb 20, 2024

It does not seem to fix anything
image

@gucio321 gucio321 removed the Likely fixed Discussion led to some point; everything seems to be fixed and issue is abandoned. Will close soon. label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants