Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. ARGHHH @ Apple/TTF

ARGHHH @ Apple/TTF

Scheduled Pinned Locked Moved The Lounge
dockerperformance
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #1

    I've spent at least a day and a half and over 1700 lines of code (compiling but most never having been executed) just *loading* a TTF file. The tables therein are convoluted. There's one named "OS/2". And yeah it appears as though it was designed by a committee of vendors led by Apple. If it wasn't I'd be shocked just because of how it turned out. Instead of baking the glyphs for the fonts out they allow you to compose "compound glyphs" which are a composite of multiple glyphs transformed and offset. I suppose it's to make the file size smaller but it makes decoding them a hassle that requires heap allocs and deallocs in order to do the bookkeeping to process the whole mess, furthering heap fragmentation and also potentially causing out of memory exceptions on RAM that's only used temporarily during the loading process and then tossed. I can see why I have to do similar with decompressing JPEGs but font files should never be this complicated. I really don't like being in the situation of having a day of coding under my belt but having not even run the code yet.

    Real programmers use butterflies

    Greg UtasG G 2 Replies Last reply
    0
    • H honey the codewitch

      I've spent at least a day and a half and over 1700 lines of code (compiling but most never having been executed) just *loading* a TTF file. The tables therein are convoluted. There's one named "OS/2". And yeah it appears as though it was designed by a committee of vendors led by Apple. If it wasn't I'd be shocked just because of how it turned out. Instead of baking the glyphs for the fonts out they allow you to compose "compound glyphs" which are a composite of multiple glyphs transformed and offset. I suppose it's to make the file size smaller but it makes decoding them a hassle that requires heap allocs and deallocs in order to do the bookkeeping to process the whole mess, furthering heap fragmentation and also potentially causing out of memory exceptions on RAM that's only used temporarily during the loading process and then tossed. I can see why I have to do similar with decompressing JPEGs but font files should never be this complicated. I really don't like being in the situation of having a day of coding under my belt but having not even run the code yet.

      Real programmers use butterflies

      Greg UtasG Offline
      Greg UtasG Offline
      Greg Utas
      wrote on last edited by
      #2

      This standard must date to a time when file size mattered. Imagine that!

      Robust Services Core | Software Techniques for Lemmings | Articles
      The fox knows many things, but the hedgehog knows one big thing.

      <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
      <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

      N 1 Reply Last reply
      0
      • Greg UtasG Greg Utas

        This standard must date to a time when file size mattered. Imagine that!

        Robust Services Core | Software Techniques for Lemmings | Articles
        The fox knows many things, but the hedgehog knows one big thing.

        N Offline
        N Offline
        Nelek
        wrote on last edited by
        #3

        Greg Utas wrote:

        This standard must date to a time when file size mattered. Imagine that!

        Good that you specified file size... :rolleyes: :-D :-D

        M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

        1 Reply Last reply
        0
        • H honey the codewitch

          I've spent at least a day and a half and over 1700 lines of code (compiling but most never having been executed) just *loading* a TTF file. The tables therein are convoluted. There's one named "OS/2". And yeah it appears as though it was designed by a committee of vendors led by Apple. If it wasn't I'd be shocked just because of how it turned out. Instead of baking the glyphs for the fonts out they allow you to compose "compound glyphs" which are a composite of multiple glyphs transformed and offset. I suppose it's to make the file size smaller but it makes decoding them a hassle that requires heap allocs and deallocs in order to do the bookkeeping to process the whole mess, furthering heap fragmentation and also potentially causing out of memory exceptions on RAM that's only used temporarily during the loading process and then tossed. I can see why I have to do similar with decompressing JPEGs but font files should never be this complicated. I really don't like being in the situation of having a day of coding under my belt but having not even run the code yet.

          Real programmers use butterflies

          G Offline
          G Offline
          Gary R Wheeler
          wrote on last edited by
          #4

          I am amazed you are writing your own TrueType renderer. Not to scare you off, but that is something that people like Microsoft and Adobe have large teams working on, even today after decades of stable implementations. Are you doing the rendering on your itty-bitty device? If not, and you're doing the rendering in a Windows app and downloading bitmap fonts to the device, you might look at GetGlyphOutlineW function (wingdi.h) - Win32 apps | Microsoft Docs[^].

          Software Zen: delete this;

          H 1 Reply Last reply
          0
          • G Gary R Wheeler

            I am amazed you are writing your own TrueType renderer. Not to scare you off, but that is something that people like Microsoft and Adobe have large teams working on, even today after decades of stable implementations. Are you doing the rendering on your itty-bitty device? If not, and you're doing the rendering in a Windows app and downloading bitmap fonts to the device, you might look at GetGlyphOutlineW function (wingdi.h) - Win32 apps | Microsoft Docs[^].

            Software Zen: delete this;

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #5

            A) Yes, yes I am. I've got it rendering, sort of. Still working out the kinks B) Yes I'm rendering on the device, because certain content like EPUB and CSS demands the ability to load fonts C) I've actually tried the .NET wrapper around that call and the path I got back was pretty neat, but I couldn't get it to align along the ascent consistently enough to rasterize it properly.

            Real programmers use butterflies

            G 1 Reply Last reply
            0
            • H honey the codewitch

              A) Yes, yes I am. I've got it rendering, sort of. Still working out the kinks B) Yes I'm rendering on the device, because certain content like EPUB and CSS demands the ability to load fonts C) I've actually tried the .NET wrapper around that call and the path I got back was pretty neat, but I couldn't get it to align along the ascent consistently enough to rasterize it properly.

              Real programmers use butterflies

              G Offline
              G Offline
              Gary R Wheeler
              wrote on last edited by
              #6

              Wow. :omg:

              Software Zen: delete this;

              H 1 Reply Last reply
              0
              • G Gary R Wheeler

                Wow. :omg:

                Software Zen: delete this;

                H Offline
                H Offline
                honey the codewitch
                wrote on last edited by
                #7

                I need to dekinkify it so I'm actually porting it to C# and back again. Or at least a portion of it. Maybe I'll post that here.

                Real programmers use butterflies

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups