Quantcast
Channel: Programming (In-game)
Viewing all articles
Browse latest Browse all 903

String class extension for string width measuring with default font

$
0
0
There is an extantion for string class with some methods in purpose to measure string width.
https://gist.github.com/krypt-lynx/497a0b8846705846038ea3f5cf8579bd

It contains:

public static int Width(this string str, char lead = '\0')
returns width of string str
lead
is previous character in line, will used to calculate kerning, if nessesary

public static int Width(this char ch)
returns width of char ch

public static int Kern(this...

String class extension for string width measuring with default font

Viewing all articles
Browse latest Browse all 903

Trending Articles