https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • b

    bright-gpu-74537

    05/12/2020, 9:52 AM
    yeah, and that
    styles/default/...
    is referenced in haxeui-kha module.xml presumably
  • b

    bright-gpu-74537

    05/12/2020, 9:52 AM
    yeah: https://github.com/haxeui/haxeui-kha/blob/master/haxe/ui/backend/module.xml#L4
  • b

    bright-gpu-74537

    05/12/2020, 9:53 AM
    so all the files there will end up as haxe resources
  • b

    bright-gpu-74537

    05/12/2020, 9:53 AM
    which means it will hit the "getFontFromHaxeResource" impl
  • b

    bright-gpu-74537

    05/12/2020, 9:54 AM
    so you can either copy that method (ie the module / haxe.Resource method), or you can use khas way (which im unsure of - in khafile.js presumably)
  • f

    fast-rain-20339

    05/12/2020, 9:56 AM
    I think I'd prefer to use a Kha consistent method if I can, but thanks for the alternative option as a backup 🙂 Kha should automatically pick up assets (and in fact outputs
    kha/Assets.hx:137: { url => Roboto-Regular.ttf }
    as part of the build process) so I think I'll keep tinkering with
    font-name: __
    🙂
  • b

    bright-gpu-74537

    05/12/2020, 9:56 AM
    cool... i guess you need to find out what the name is that can be used with
    Assets.fonts.get(...)
    and use that for font-name
  • b

    bright-gpu-74537

    05/12/2020, 9:57 AM
    id be interested to see how Roboto looks in kha too... 🙂
  • b

    bright-gpu-74537

    05/12/2020, 10:03 AM
    Reflect.fields(kha.Assets.fonts);
    should help
  • f

    fast-rain-20339

    05/12/2020, 10:08 AM
    Ah that was a good suggestion. So Kha is substituting the
    -
    for a
    _
    . Reflecting the fields got me
    [Roboto_Medium,Roboto_MediumDescription,Roboto_Regular,Roboto_RegularDescription,arial...
    . I eagerly put
    Roboto_Medium
    as the font but unfortunately that didn't work, hmm.
  • b

    bright-gpu-74537

    05/12/2020, 10:10 AM
    i got:
  • b

    bright-gpu-74537

    05/12/2020, 10:10 AM
    :/
  • b

    bright-gpu-74537

    05/12/2020, 10:10 AM
    but it looks like it did load the font
  • f

    fast-rain-20339

    05/12/2020, 10:11 AM
    Hmm
  • f

    fast-rain-20339

    05/12/2020, 10:12 AM
    Tracing
    trace(kha.Assets.fonts.get("Roboto_Regular"));
    returns
    null
  • a

    ambitious-knife-25690

    05/12/2020, 10:12 AM
    gotta preload the font
  • f

    fast-rain-20339

    05/12/2020, 10:13 AM
    This is all within
    Assets.loadEverything
  • b

    bright-gpu-74537

    05/12/2020, 10:13 AM
    yeah, im calling that also
  • b

    bright-gpu-74537

    05/12/2020, 10:15 AM
    Copy code
    haxe
                while (status <= 0) {
                    if (height < width) height *= 2;
                    else width *= 2;
                    trace("------------------> " + (width * height));
                    pixels = Blob.alloc(width * height);
                    status = StbTruetype.stbtt_BakeFontBitmap(blob, 0, fontSize, pixels, width, height, glyphs, baked);
                }
  • f

    fast-rain-20339

    05/12/2020, 10:17 AM
    Not sure what that means I'm afraid
  • b

    bright-gpu-74537

    05/12/2020, 10:18 AM
    kha is trying to allocate 4GB of mem for the font... maybe its just the font i used
  • f

    fast-rain-20339

    05/12/2020, 10:18 AM
    ohh. Hm, it seems more likely to me that the font was null and it breaks this loop
  • b

    bright-gpu-74537

    05/12/2020, 10:18 AM
    font isnt null though
  • b

    bright-gpu-74537

    05/12/2020, 10:19 AM
    StbTruetype.stbtt_BakeFontBitmap doesnt like something though
  • f

    fast-rain-20339

    05/12/2020, 10:20 AM
    I just built for html5 and I think it worked (I was building for linux before), though it's a bit hard to tell because Roboto isn't very distinct lol
  • f

    fast-rain-20339

    05/12/2020, 10:21 AM
    It's not printing null though, so I think it might be actually Roboto
  • b

    bright-gpu-74537

    05/12/2020, 10:22 AM
    that looks like roboto to me
  • b

    bright-gpu-74537

    05/12/2020, 10:22 AM
    try a side by side comaprison:
  • b

    bright-gpu-74537

    05/12/2020, 10:22 AM
    <label text="Test Font" style="font-name:'ZOMBIES_REBORN';font-size:30px;" />
  • f

    fast-rain-20339

    05/12/2020, 10:22 AM
    That was my first time building html5 for this project, so it may just be that /build/ wasn't updating. Deleted /build/ and doing a fresh linux build 🙂
1...206207208...1687Latest