package main import emoji "github.com/tmdvs/Go-Emoji-Utils" var charWidths = map[string]float64{ " ": 4.9, "0": 14.333328247070312, "1": 10.583328247070312, "2": 13.433334350585938, "3": 14.01666259765625, "4": 14.333328247070312, "5": 13.866668701171875, "6": 14.199996948242188, "7": 12.966659545898438, "8": 14.199996948242188, "9": 14.199996948242188, "A": 14.949996948242188, "B": 14.366668701171875, "C": 16.183334350585938, "D": 16.050003051757812, "E": 13.133331298828125, "F": 12.566665649414062, "G": 16.666671752929688, "H": 16.51666259765625, "I": 5.600006103515625, "J": 11.816665649414062, "K": 14.583328247070312, "L": 12.5, "M": 19.550003051757812, "N": 16.51666259765625, "O": 17.25, "P": 13.75, "Q": 17.25, "R": 14.23333740234375, "S": 14.083328247070312, "T": 13.816665649414062, "U": 16.433334350585938, "V": 14.949996948242188, "W": 21.683334350585938, "X": 15.033340454101562, "Y": 14.51666259765625, "Z": 14.616668701171875, "a": 11.98333740234375, "b": 13.216659545898438, "c": 11.98333740234375, "d": 13.199996948242188, "e": 12.25, "f": 7.4499969482421875, "g": 13.100006103515625, "h": 12.850006103515625, "i": 5.133331298828125, "j": 5.133331298828125, "k": 11.633331298828125, "l": 5.133331298828125, "m": 18.966659545898438, "n": 12.583328247070312, "o": 12.683334350585938, "p": 13.100006103515625, "q": 13.100006103515625, "r": 7.5833282470703125, "s": 11.166671752929688, "t": 7.4166717529296875, "u": 12.583328247070312, "v": 11.583328247070312, "w": 16.916671752929688, "x": 11.25, "y": 11.649993896484375, "z": 11.26666259765625, "!": 6.5666656494140625, "@": 20.550003051757812, "£": 14.333328247070312, "#": 14.300003051757812, "$": 14.333328247070312, "%": 18.416671752929688, "^": 9.683334350585938, "*": 9.683334350585938, "(": 7.883331298828125, ")": 7.883331298828125, "-": 10.300003051757812, "_": 9.73333740234375, "=": 14.333328247070312, "+": 14.333328247070312, "[": 7.883331298828125, "]": 7.883331298828125, "{": 7.883331298828125, "}": 7.883331298828125, ";": 6.26666259765625, ":": 6.26666259765625, "'": 5.26666259765625, "\"": 9.5, ",": 6.26666259765625, ".": 6.26666259765625, "/": 7.76666259765625, "?": 11.649993896484375, "`": 11.833328247070312, } func getCharWidth(char string) float64 { width, ok := charWidths[char] if !ok { if len(emoji.FindAll(char)) > 0 { width = 24 } else { width = 8 } } return width }