Skip to content

Different bitmap results in dev and release builds #273

@Stysner

Description

@Stysner

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:")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions