-
• #27
Thanks @NebbishHacker for the code.
the slanted font need a different width to have a good kerning.
I use a fixed size font of 9x8 px.
i had an array to specify the with of each letter for a correct kerning// a b c d e f g h i j k l m n o p q r s t u v w x y z var largeurLettres = [3,0,0,0,6,5,4,0,3,5,5,3,8,0,0,0,5,5,0,4,0]; function drawStringSlanted(text, x, y) { var largeur = 0; for (var char of text) { g.drawString(char, x, y); index = char.charCodeAt(0); // 65 is my offset in the array for lowercase (i do not draw all the font) and 32 for my first char (space) x += (largeurLettres[index-(65-32)]+ 2); } }
2 Attachments
-
• #28
Nice, looks like a good solution :)
You can make the letters overlap by passing a negative spacing into the function I posted: