GithubHelp home page GithubHelp logo

Comments (8)

AllenDang avatar AllenDang commented on July 20, 2024 1

@kiwidoggie I'm using Golang binding so I guess I cannot help you one this...

from nuklear.

dumblob avatar dumblob commented on July 20, 2024

As mentioned in Credits in Readme.md, by default Nuklear embeds stb_truetype for basic font rendering, but you're free to use e.g. freetype (there might be some examples in this repo IIRC).

On the other hand, it seems stb_truetype wasn't updated for quite long in Nuklear and upstream has a new version where chances are, that the blurring will be less significant.

from nuklear.

AllenDang avatar AllenDang commented on July 20, 2024

@dumblob Thanks for your reply. I checked those two codes, is there any utils to generate from stb_truetype? So far as I see, the code is hand write line by line, not just embed directly. It seems to update is not an easy work. Am I correct?

from nuklear.

dumblob avatar dumblob commented on July 20, 2024

@AllenDang yeah, you're right - feel free to make a PR and separate stb_truetype completely (we use the Python packing script in the same folder through paq.sh/paq.bat - see also minor changes to this "amalgamation" which we didn't have time yet to finally review and merge).

from nuklear.

kiwidoggie avatar kiwidoggie commented on July 20, 2024

@AllenDang how are you rendering the Chinese font's. I'm having an issue from wchar_t to char conversion using the nk_label's.

from nuklear.

AllenDang avatar AllenDang commented on July 20, 2024

@dumblob I'm trying to update stb_truetype embeded in nuklear_font.h and I find out that I need to do a lot of function and struct naming replacement there.
I'm wondering how do you do it at first place? All hand-writing or there is a script which does the "search-and-replace" work?

from nuklear.

 avatar commented on July 20, 2024

I have had issues with blurry fonts as well.
What fixed it for me is finding the correct scaling value. For whatever reason, in my testing each font has a scaling value, where the font is sharp. These sharp scaling values come in steps of integers.
One font always remains sharp in steps of 4, size 24, 28, 32 etc... whilst one font only remains sharp in steps of 6, size 19, 25, 31 etc... All other values make stb_truetype produce blurry results.
All of this with oversample_v = 1, oversample_h = 1 and pixel_snap = 1.

Cranking up oversampling only helps a teeny tiny bit whilst costing a bunch of memory. If you have Window's OpenGL software fallback, then you are limited to max 1024 size textures. Oversampling easily shoots past that and you get black squares.

I tied the font scale to a slider + bake loop and tried out different fonts and sizes in real time. This is the way I found out about it and the right values. So maybe try the same.

Hope this will be fixed with the new exellent PR #53 (Although stb_truetype still does not support font hinting...)

from nuklear.

dumblob avatar dumblob commented on July 20, 2024

@AllenDang could you retest if the update of stb_truetype (see PR #53 ) solved your problem?

from nuklear.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.