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

Different bitmap results in dev and release builds #273

Open
Stysner opened this issue Mar 20, 2024 · 0 comments
Open

Different bitmap results in dev and release builds #273

Stysner opened this issue Mar 20, 2024 · 0 comments

Comments

@Stysner
Copy link

Stysner commented Mar 20, 2024

When building my application normally (the "dev" profile) everything works as intended; I set the face, set character sizes, then get glyphs and render them, putting the resulting bitmap buffer in a shader: no issues whatsoever.

If I run the exact same code in release mode (both my dev and release profiles are set to optimization level 3 and LTO "thin"), everything still works but the bitmaps are way lower resolution than they should be but glyphs still output the same (correct) metrics.

I've tried taking ownership of the bitmap buffer right after rendering (using to_vec or to_owned) but the problem is the exact same.

Freetype calls in order:

let face = ft.new_face(file_path, 0)
face.set_pixel_sizes(...)
face.height() face.ascender() and face.descender()

Getting the char:

face.get_char_index(...)
face.load_glyph(id, LoadFlag::DEFAULT)
let glyph = face.glyph()
glyph.render_glyph(RenderMode::Normal)
let bitmap = glyph.bitmap()

Then I send the bitmap to the GPU (OpenGL) using bitmap.buffer().as_ptr() as *cont c_void

Lastly I get the metric for the glyph using let metrics = glyph.metrics()

After this the next character is processed (starting from "Getting the char:")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant