anchor.diff:    for I := 0 to 255 do
     for K := 0 to 255 do
     begin
  -    chMaxX := 0;
  -    chMaxY := 0;
  +    chMaxX := -1;
  +    chMaxY := -1;
   
       //Scan all pixels of a single letter to determine its dimensions
  -    //Excluding 1/1 coords which are for grid lines (irregardless of visibility)
  -    for L := 1 to cellY - 1 do
  -    for M := 1 to cellX - 1 do
  +    for L := 0 to cellY - 1 do
  +    for M := 0 to cellX - 1 do
       begin
         //Pixel coords
         cX := K * cellX + M;
         cY := I * cellY + L;
   
  -      if pngData[cY * pngWidth + cX] shr 24 > 0 then
  +      if pngData[cY * pngWidth + cX] <> BG_COLOR then
         begin
           chMaxX := Math.Max(chMaxX, M);
           chMaxY := Math.Max(chMaxY, L);
  
positive.code: procedure TKMFontDataEdit.ExportGridPng(const aFilename: string; aPadding: TRect);
  var
    cellX, cellY, pngWidth, pngHeight: Word;
    I, K, M, L: Integer;
    chWidth, chHeight: Byte;
    srcX, srcY: Word;
    dstPixel, srcPixel: Cardinal;
    data: TKMCardinalArray;
  begin
    //+1 for the grid
    cellX := MaxLetterWidth + 1 + aPadding.Left + aPadding.Right;
    cellY := MaxLetterHeight + 1 + aPadding.Top + aPadding.Bottom;
    pngWidth := 256 * cellX;
    pngHeight := 256 * cellY;
  
    SetLength(data, pngWidth * pngHeight);
  
    //Draw grid
    for I := 0 to 255 do
    for K := 0 to pngWidth - 1 do
      data[I * cellY * pngWidth + K] := $FF00FF00;
  
    for K := 0 to 255 do
    for I := 0 to pngHeight - 1 do
      data[K * CellX + I * pngWidth] := $FF00FF00;
  
    //Draw letters
    for I := 0 to fCharCount - 1 do
  
negative.code:     chWidth := Letters[I].Width;
      chHeight := Letters[I].Height;
  
      //Cut the window for the character
      for M := 0 to chHeight + aPadding.Top + aPadding.Bottom - 1 do
      for L := 0 to chWidth + aPadding.Left + aPadding.Right - 1 do
      begin
        dstPixel := ((I div 256) * cellY + M) * pngWidth + (I mod 256) * cellX + L;
        data[dstPixel] := $00000000;
      end;
  
      //Copy the character over
      for M := 0 to chHeight - 1 do
      for L := 0 to chWidth - 1 do
  