kuuhana
  • Communities
  • Multi-communities
  • Support Lemmy
  • Search
  • Login
  • Sign Up
Programmer Humor@programming.devbyals@lemmy.blahaj.zone
7 months

Jenga Stack

lemmy.blahaj.zone English

Original post: https://mastodon.social/@chechar/115571726910318246

20
    You must log in or register to comment.

    • DaPorkchop_ [any]@lemmy.ml
      7 months

      from the HarfBuzz GitHub readme

        • calcopiritus@lemmy.world
          7 months

          I cannot comprehend what the fuck harfbuzz does.

          I tried to implement my own because “I don’t need all the features, I’m gonna render self-to-right western text with very few font features”. But holly fuck, the font format documentation is barely non-existent. And when I tried my naive solution it was like 10000x (or more) slower than harfbuzz.

            • chellomere@lemmy.world
              7 months

              HarfBuzz does opentype shaping, that is, transforming strings of unicode characters to lists of glyphs with positioning. The significance of this can be hard to understand for someone used to the latin script, as that needs very little shaping - kerning is often the only thing that’s absolutely necessary.

              But in complex scripts, most notably the Indic, there’s a lot going on. Unicode characters can merge into one glyph under circumstances, or one character can split into several, and relative positioning in both the x and y axis is imperative.

              A reason that OpenType shaping is complex is that part of the rules for what to do will be found in the font, and part will need to be hard-coded in the code implementing it.

              If you’re going to roll your own text renderer, you’ll have to care about the following areas:

              • Rasterization/rendering to bitmaps, including hinting (notoriously difficult, old-style TrueType hinting instructions are bytecode, so you’ll be writing a tiny VM for this)
              • Shaping (Kerning at a minimum, full OpenType shaping for international support)
              • BiDi (for full international support, primarily Hebrew and Perso-Arabic)
              • A caching system for rendered text glyphs and shaped text runa, as it will be too slow to perform this each time you want to render some text

              Let’s just say that I do not recommend going this route unless you’re prepared to spend a lot of time on it.

                • calcopiritus@lemmy.world
                  7 months

                  I’ve got all that. I just needed to convert a string of characters into a list of glyph IDs.

                  For context, I’m doing a code editor.

                  I don’t use harfbuzz for shaping or whatever, since I planned on rendering single lines of mono spaced text. I can do everything except string->glyphs conversion.

                  Just trying to implement basic features such as ligatures is incredibly hard, since there’s almost no documentation. Therefore you can’t make assumptions that are necessary to take shortcuts and make optimizations. I don’t know if harfbuzz uses a source of documentation that I haven’t been able to find, or maybe they are just way smarter than me, or if fonts are made in a way that they work with harfbuzz instead of the other way around.

                  As someone trying to have as little dependencies as possible, it is a struggle. But at the same time, harfbuzz saved me soo much time.

                  EDIT: I don’t do my own glyph rasterization, but that’s because I haven’t gotten to it yet, so I do use a library. I don’t know if it’s going to be harder than string->glyphs, but I doubt so.

                    • chellomere@lemmy.world
                      7 months

                      It would make sense that a code editor could use a more limited subset of text rendering that could be more optimized.

                      Perhaps a bit surprisingly, Microsoft actually has pretty good documentation on OpenType. Here’s info on what shaping applies to “standard” scripts:

                      https://learn.microsoft.com/en-us/typography/script-development/standard

                      And here’s the landing page for the latest OpenType spec:

                      https://learn.microsoft.com/en-us/typography/opentype/spec/

                      Specifically for ligatures, you’re looking for the liga feature which is specified in the font’s GSUB table.

                      • psud@aussie.zoneEnglish
                        7 months

                        This is the harfbuzz documentation

                • Justas🇱🇹@sh.itjust.works
                  7 months

                  Cloudflare would be more like a leaf covering the image because you don’t need it to operate the stack, you need it to work in order to be able to see what it’s doing.

                  • okgurl@lemmy.world
                    7 months

                    us east 1 not 2 xD but truth

                      • ook@discuss.tchncs.de
                        7 months

                        Well you know which one is next

                        • carrylex@lemmy.world
                          7 months

                          us-east-2 is in Ohio so…

                            • QuazarOmega@lemy.lol
                              7 months

                              This stack meme has LAYERS

                          • silver@das-eck.hausEnglish
                            7 months

                            Definitely us-east-1 instead of 2, nobody (any fortune 500) has time for all that resiliency. Or even the patience for changing the region in the console. Ask me how I know

                              • Barbecue Cowboy@lemmy.dbzer0.comEnglish
                                7 months

                                I do hate having to switch regions in the console.

                                  • blackn1ght@feddit.uk
                                    7 months

                                    When you log into the console and all your shits gone and you start to have a mild panic, when you suddenly realise it’s switched you to a different region.

                                • aaaaaaaaargh@feddit.org
                                  7 months

                                  I wouldn’t mind the open source part, at least we can see why it breaks.

                                    • magic_lobster_party@fedia.io
                                      7 months

                                      There’s always that one Microsoft engineer who is annoyed about OpenSSH being slightly slower

                                        • psud@aussie.zoneEnglish
                                          7 months

                                          Are you talking about the one that detected the malware in openSSH?

                                        • halcyoncmdr@lemmy.worldEnglish
                                          7 months

                                          Giving winring0 vibes.

                                        • Juanjo Salvador@programming.dev
                                          7 months

                                          I understand the concept, but the autistic engineer I have inside is a bit uncomfy with the design of this pile, implying that AWS depends on Azure.

                                          • humanspiral@lemmy.ca
                                            7 months

                                            an npm library to right pad strings is somewhere in there.

                                            Programmer Humor@programming.dev

                                            programmer_humor@programming.dev

                                            Subscribe from remote instance

                                            Create post

                                            Report community

                                            Modlog
                                            You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

                                            Welcome to Programmer Humor!

                                            This is a place where you can post jokes, memes, humor, etc. related to programming!

                                            For sharing awful code theres also Programming Horror.

                                            Rules

                                            • Keep content in english
                                            • No advertisements
                                            • Posts must be related to programming or programmer topics
                                            Visibility: Public

                                            This community is visible to everyone.

                                            • 178 users / Day
                                            • 205 users / Week
                                            • 212 users / Month
                                            • 14.5K users / 6 months
                                            • 2.33K posts
                                            • 89.8K comments
                                            • 2 local subscribers
                                            • 31.9K subscribers
                                            • UI: 1.0.0-beta.0
                                            • BE: 1.0.0-alpha.20
                                            • Modlog
                                            • Instances
                                            • Docs
                                            • Code
                                            • join-lemmy.org