mirror of
https://github.com/freedoom/freedoom.git
synced 2025-08-30 08:16:54 -04:00
Merge remote-tracking branch 'origin/kerning-tweaks'
This commit is contained in:
commit
e7ad8ea2e6
2 changed files with 48 additions and 28 deletions
|
@ -11,45 +11,63 @@ import re
|
|||
# visually appealing. This is highly dependent on the font graphics,
|
||||
# and if the font is changed this probably needs to be redone.
|
||||
|
||||
# TODO: Add more rule for lower-case characters.
|
||||
|
||||
FONT_KERNING_RULES = {
|
||||
# Right character fits under left character:
|
||||
r"[TY][07ACOSZ]": -2,
|
||||
r"[TYty][a]": -2,
|
||||
r"P[A]": -3,
|
||||
r"T[0ACOSZacos]": -2,
|
||||
r"V[OC]": -2,
|
||||
r"Y[ASZacs]": -2,
|
||||
r"Y[CO0]": -1,
|
||||
r"P[Aa]": -3,
|
||||
r"P[7]": -2,
|
||||
r"P[Z]": -1,
|
||||
r"7[Z]": -1,
|
||||
r"[0OQ]A": -1,
|
||||
r"[0O][Aa]": -1,
|
||||
r"S[A]": -1,
|
||||
r"V[0OC]": -2,
|
||||
r"Sa": -2,
|
||||
r"Wa": -1,
|
||||
r"p[a]": -1,
|
||||
r"s[ao]": -1,
|
||||
r"ta": -2,
|
||||
r"v[oc]": -1,
|
||||
r"y[oacs]": -1,
|
||||
# Left character fits under right character:
|
||||
r"L[TY]": -4,
|
||||
r"L[014COQV]": -3,
|
||||
r"L[9]": -2,
|
||||
r"[0O][4TY]": -2,
|
||||
r"L[4Q]": -3,
|
||||
r"L[O0CTYtcq]": -2,
|
||||
r"L[oyVv]": -1,
|
||||
r"l[tTY]": -2,
|
||||
r"l[y]": -1,
|
||||
r"[0O][4TYy]": -2,
|
||||
r"[0O][1]": -1,
|
||||
r"Q[1T]": -2,
|
||||
r"Q[Y]": -1,
|
||||
r"A[TYV]": -2,
|
||||
r"A[GC]": -1,
|
||||
r"a[TYty]": -2,
|
||||
r"a[vV]": -2,
|
||||
r"a[g]": -1,
|
||||
r"Q[1TY]": -2,
|
||||
r"A[CGTYt]": -2,
|
||||
r"A[cgy]": -1,
|
||||
r"a[cTYt]": -2,
|
||||
r"a[vVy]": -1,
|
||||
# Fits into "hole" in left character:
|
||||
r"[BCX8][0CGOQ]": -2,
|
||||
r"B[0CGOQ]": -2,
|
||||
r"B[0cgq]": -2,
|
||||
r"C[0CGOQ]": -3,
|
||||
r"C[q]": -2,
|
||||
r"C[cgo]": -1,
|
||||
r"X[0CO]": -3,
|
||||
r"X[Qqco]": -2,
|
||||
r"8[0CO]": -3,
|
||||
r"8[GQcgqo]": -2,
|
||||
r"Z[0CO]": -2,
|
||||
r"Z[GQ]": -1,
|
||||
r"I[0COQ]": -1,
|
||||
r"Z[GQocgq]": -1,
|
||||
r"I[0COQcoq]": -1,
|
||||
r"K[0CO]": -4,
|
||||
r"K[GQ]": -3,
|
||||
r"K[E]": -1,
|
||||
r"[PR][0COQ]": -1,
|
||||
r"K[cgo]": -2,
|
||||
r"K[Eq]": -1,
|
||||
r"P[0COQcoq]": -1,
|
||||
r"R[0COQcoq]": -1,
|
||||
# Fits into "hole" in right character:
|
||||
r"[O0Q][X]": -3,
|
||||
r"[O0Q][28]": -2,
|
||||
r"[O0Q][9IK]": -1,
|
||||
r"[O0][2X8]": -3,
|
||||
r"[O0][9Kx]": -2,
|
||||
r"[O0][Iik]": -1,
|
||||
r"Q[28X]": -2,
|
||||
r"Q[9Iix]": -1,
|
||||
r"q[IXx]": -1,
|
||||
# Just because.
|
||||
r"[O0][O0]": -1,
|
||||
}
|
||||
|
|
|
@ -155,12 +155,14 @@ def generate_kerning_test(font):
|
|||
if font.kerning_adjust(char1, char2) != 0:
|
||||
pairs.append(char1 + char2)
|
||||
|
||||
cmd = font.generate_graphic(" ".join(pairs), "kerning.png")
|
||||
image = font.generate_graphic(" ".join(pairs))
|
||||
image.save("kerning.png")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
font = TextGenerator("fontchars", kerning_table=FONT_KERNING_RULES)
|
||||
#generate_kerning_test(font)
|
||||
generate_graphics(font, red_graphics, color=font.COLOR_RED)
|
||||
generate_graphics(font, blue_graphics, color=font.COLOR_BLUE)
|
||||
generate_graphics(font, white_graphics, color=font.COLOR_WHITE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue