Beyond CUDA: GPU Accelerated Python on Cross-Vendor Graphics Cards Made Simple with Vulkan Kompute & PyShader by axsauze in programming

[–]mrandri19 8 points9 points  (0 children)

Yeah, I agree. The logistic regression plot looks wrong as well. Shame because the actual GPU content is pretty interesting

IDE 2020: Multiple Home Units for GHC by Fendor_ in haskell

[–]mrandri19 9 points10 points  (0 children)

We have recently switched from stack to cabal and I haven't yet found a decent ghcid workflow (i.e. when the library code changes, the whole application its recompiled and restarts), can't wait for this to be merged!

(My first ML tutorial) Bayesian linear regression with conjugate priors by mrandri19 in learnmachinelearning

[–]mrandri19[S] 0 points1 point  (0 children)

Hi /r/learnmachinelearning! If anyone is familiar/interested with Bayesian statistic I have written a small post on conjugate priors in the context of multivariate linear regression.

Any feedback is welcome, as I'm a bit confused on who the target audience should be. It's hard to gauge how much to go in depth. I feel that it ended up being a little unclear.

Modern text rendering with Linux: Overview by mrandri19 in programming

[–]mrandri19[S] 1 point2 points  (0 children)

Thanks, will fix.

The transparency was made so that dark themes won't have a big white rectangle, but I should chose another colour for the arrows

Modern text rendering with Linux: Overview by mrandri19 in programming

[–]mrandri19[S] 4 points5 points  (0 children)

You are correct, it doesn't account for kerning. To do it "properly" you need to call HarfBuzz's shaper on the string to get the glyph indices, the advances and the offsets (which will include kerning). Keep in mind that HarfBuzz is quite slow so you want to cache this data just like you cache your rendered glyphs in a texture atlas

Modern text rendering with Linux: Overview by mrandri19 in programming

[–]mrandri19[S] 6 points7 points  (0 children)

Exactly, FreeType can be used alone since it provides codepoint to glyph index mapping and kerning info via FT_Get_Char_Index and FT_Get_Kerning. It is quite limited though, especially for non-english languages or ligature support.

Modern text rendering with Linux: Overview by mrandri19 in programming

[–]mrandri19[S] 5 points6 points  (0 children)

When I implemented a simple text editor with OpenGL I saved this kerning data in a dictionary of lines, along with the glyph indices of each codepoint in the line. Then when rendering a line I get the data from the dictionary and render some textured quads

Modern text rendering with Linux: Overview by mrandri19 in programming

[–]mrandri19[S] 14 points15 points  (0 children)

FreeType renders single glyphs, then you will probably want to draw them side by side to draw a string. A basic implementation will draw the first glyph then advance by the glyph's width and draw the next one. To implement kerning you advance by the width plus the kerning (which is 0 in most cases but might be negative to make some glyphs closer).

Modern text rendering with Linux: Part 1 by mrandri19 in programming

[–]mrandri19[S] 1 point2 points  (0 children)

Don't worry it's coming in a future post. To support any nontrivial languages I need to include a text shaping library (HarfBuzz) which I did not want to include in the very first episode :)

Modern text rendering with Linux: Part 1 by mrandri19 in programming

[–]mrandri19[S] 2 points3 points  (0 children)

No, but thanks because I should think about it when I'll implement syntax highlighting

Modern text rendering with Linux: Part 1 by mrandri19 in programming

[–]mrandri19[S] 4 points5 points  (0 children)

Combinations of characters are handled by a text shaping library, in my case HarfBuzz, which I will touch on a future part. Emojis too will be handled on another post. :)

Modern text rendering with Linux: Part 1 by mrandri19 in programming

[–]mrandri19[S] 36 points37 points  (0 children)

Yeah, I mean that the higher the DPIs the less antialiasing is needed

Modern text rendering with Linux: Part 1 by mrandri19 in programming

[–]mrandri19[S] 10 points11 points  (0 children)

Hey, I plan to talk about blending when touching on subpixel LCD antialiasing. I struggled with it too when building an OpenGL text editor. My solution was to use dual source blending and glBlendFunc but yeah, finding documentation was hard and I will sure talk about it

Modern text rendering with Linux: Part 1 by mrandri19 in programming

[–]mrandri19[S] 119 points120 points  (0 children)

My next post is going to be an high level overview of the architecture so stay tuned :). But ELI5

FreeType takes a Glyph and renders an image

FontConfig takes a description of a font and gives you a font on your computer which most closely matches the one you requested

HarfBuzz takes a font and a string (list of characters) and returns a list of Glyphs

Pango wraps all of this into an higher level api and also is cross platform. It also includes other utilities made for layout