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

Fonts breaks when resizing gg window #21610

Open
Cieciak opened this issue May 30, 2024 · 0 comments
Open

Fonts breaks when resizing gg window #21610

Cieciak opened this issue May 30, 2024 · 0 comments
Labels
Bug This tag is applied to issues which reports bugs. Graphics/multimedia/gg/sokol A video, sound, rendering, or fonts related issue. Status: Confirmed This bug has been confirmed to be valid by a contributor.

Comments

@Cieciak
Copy link

Cieciak commented May 30, 2024

Describe the bug

When resizing window font changes shape or vanishes

Reproduction Steps

After running, resize window using mouse and font breaks, small changes have dramatic effect

module main

import gg
import gx

struct App {
    pub mut:
        context &gg.Context

        vw int
        vh int
}

fn main() {
    mut app := App{
        context: &gg.Context{}
    }

    app.context = gg.new_context(
        bg_color: gx.rgb(0x44, 0x44, 0x44)
        window_title: 'Text test'
        frame_fn: frame
        resized_fn: resize_handler
        user_data: &app
    )
    app.context.run()
}

fn resize_handler(event &gg.Event, mut app App){
    app.vw = event.window_width
    app.vh = event.window_height
}

fn frame(mut app App) {
    app.context.begin()

    cfg := gx.TextCfg{
        size: app.vh / 5
    }

    app.context.draw_text(100, 100, 'Hello There!', cfg)
    app.context.end()
}

pic1
pic2
pic3
Each image has slightly different resolution

Expected Behavior

The font should stay consistent

Current Behavior

Font does not stay consistent, as presented on pic1 to pic3

Possible Solution

No response

Additional Information/Context

I use 4K display, but checked it on windows, linux and mac on different resolutions and fonts, all broken

V version

V 0.4.6 52dfef1

Environment details (OS name and version, etc.)

V full version: V 0.4.6 40da0f7.52dfef1
OS: linux, Zorin OS 17.1
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz

getwd: /home/niko
vexe: /home/niko/v/v
vexe mtime: 2024-05-30 15:55:44

vroot: OK, value: /home/niko/v
VMODULES: OK, value: /home/niko/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.34.1
Git vroot status: weekly.2023.51-1050-g52dfef1a
.git/config present: true

CC version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
thirdparty/tcc status: thirdparty-linux-amd64 40e5cbb5

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@Cieciak Cieciak added the Bug This tag is applied to issues which reports bugs. label May 30, 2024
@spytheman spytheman added Graphics/multimedia/gg/sokol A video, sound, rendering, or fonts related issue. Status: Confirmed This bug has been confirmed to be valid by a contributor. labels Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Graphics/multimedia/gg/sokol A video, sound, rendering, or fonts related issue. Status: Confirmed This bug has been confirmed to be valid by a contributor.
Projects
None yet
Development

No branches or pull requests

2 participants