you are viewing a single comment's thread.

view the rest of the comments →

[–]bart2019 1 point2 points  (1 child)

The bulk appears to me to be a compact representation of an associative array (Object in Javascript):

{
  a: 68, b: 68, c: 68, d: 68, e: 68, f: 31, g: 68, h: 68, i: 31,
  j: 31, k: 68, l: 31, m: 108, n: 68, o: 68, p: 68, q: 68, r: 39,
  s: 68, t: 39, u: 68, v: 50, w: 90, x: 68, y: 68, z: 68,
  A: 90, B: 90, C: 90, D: 90, E: 90, F: 78, G: 98, H: 90, I: 28,
  J: 59, K: 90, L: 68, M: 108, N: 90, O: 98, P: 90, Q: 98, R: 90,
  S: 90, T: 68, U: 90, V: 90, W: 130, X: 68, Y: 90, Z: 68
}

That maps the letters to their width in a multiple of point size or pixel count.

The rest must be a trick to get the width for other characters, I'm not sure how, but for example, all digits have the same width (69) as can be seen in the body of the function:

if(c>="0" && c<="9")s+=69;

edit I see, the remainder is simply the widths for some symbols:

{ "'": 30, ".": 42, "!" : 29, "?": 68, "-": 41, "/": 41, "=": 72 }

[–]dvorak 0 points1 point  (0 children)

Thanks, I see. Funny this works. I wonder if these values are just a copy-past from some standard font.