diff --git a/chars.go b/chars.go index 01dcfc0..162e84f 100644 --- a/chars.go +++ b/chars.go @@ -77,6 +77,7 @@ var charWidths = map[string]float64{ "(": 7.8, ")": 7.8, "-": 10.300003051757812, + "—": 10.300003051757812, "_": 9.73333740234375, "=": 14.333328247070312, "+": 14.333328247070312, diff --git a/main.go b/main.go index 1e46a86..2644b4b 100644 --- a/main.go +++ b/main.go @@ -208,8 +208,10 @@ func calculateHeight(tweet anaconda.Tweet) int64 { lineHeight := 28.0 tweetText := strings.ReplaceAll(tweet.FullText, "
", " \n") tweetText = strip.StripTags(tweetText) + tweetText = strings.ReplaceAll(tweetText, "--", "——") words := regexp.MustCompile(`[ |-]`).Split(tweetText, -1) for _, word := range words { + word = strings.ReplaceAll(word, "——", "--") if len(emoji.FindAll(word)) > 0 { lineHeight = 32.0 }