Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8098116

Support glyph rasterisation to sub-pixel precision




      Grey scale anti-aliased glyphs that are not grid-fitted (hinted and snapped to a pixel grid) naturally have non-integral advances.
      However they are always rasterised in a way that expects they are drawn without any offset into the pixel. ie at whole pixel positions.
      This means that the spacing to the subsequent glyph is not ideally spaced.
      If glyph advances are all rounded to integrals then the glyphs will be spaced evenly, but this will lead to extra space between
      each glyph so that the overall string is now longer than it should be and not uniformly scaling, and most or even all, inter-glyph
      spacing will not be ideal.
      The non-uniform scaling means you might as well just do everything hinted as you'll be back to a sitiuation where a 2X scale on
      the graphics does NOT mean a 2X scale on the string length.

      The answer is to produce glyphs which have images tuned to be rendered at a sub-pixel offset. Probably 0.25 pixels is sufficient.
      This will minimise, maybe eliminate, any perceptible uneven glyph spacing, although it does mean that two adjacent instances
      of the same code point (glyph) will be subtely different because the greyscale coverage values can be offset by 0.5 pixels.
      It also means more overhead in rendering and caching, so we probably want to be able to control when we do this.

      LCD glyphs should be able to do the same but there 1/3 of a pixel is the likely precision.
      T2K provides enough info to do this I need to check what happens with glyphs produced by Windows GDI.

      PS .. I thought we already had this filed somewhere but I can't find it so hence this task.


        1. RT-14187.png
          24 kB
        2. SubpixelGrayscale.PNG
          4 kB
        3. SubpixelModes.png
          20 kB

        Issue Links



              fheidric Felipe Heidrich (Inactive)
              prr Philip Race
              6 Vote for this issue
              16 Start watching this issue