How would I make Times New Roman but every 7th letter is jarringly sans serif?

I want to make a “font” script that can make text look like it’s Times New Roman but every 7th letter is jarringly sans serif.
image

This post is just for jokes but I think this could spark other ideas or possibilities. My current idea to do it is to make individual TextLabel instances with one letter each, space them out properly depending on the letter, and every 7th letter’s font will be a sans serif one.

I put this in scripting support because I almost 100% know that doing this will require scripts.

I would just use rich text textlabels and formatting tags to do this.

function Jarrify(String: string, FontAdd: Enum.Font, SpaceAmount: number)
	local JarredString = ""
	SpaceAmount = SpaceAmount or 4
	
	local FinalScuffLetter
	for Letter=SpaceAmount+1, string.len(String), SpaceAmount do
		JarredString = `{JarredString}{string.sub(String, Letter-SpaceAmount+1, Letter-1)}<font face = "{FontAdd.Name}">{string.sub(String, Letter, Letter)}</font>`
		
		FinalScuffLetter = Letter
	end
	
	JarredString = `{string.sub(String, 1, 1)}{JarredString}{string.sub(String, FinalScuffLetter+1, -1)}`
	
	return JarredString
end

local Example = Jarrify("This should look super scuffed or im gonna bash my head against the wall.", Enum.Font.Creepster, 3)


This doesn’t account for spaces but you can figure that one out yourself

2 Likes

Very nice :slight_smile:. I’ve just been thinking about small performance optimisations and how string concatenation can be extravagant with memory.

If you don’t mind, following your idea, I found gsub and a matching pattern also work well: . for any character, %w for alphanumeric, and so forth.

local function Jarrify(String: string, FontAdd: Enum.Font, SpaceAmount: number)
	local Count = 0
	return string.gsub(String, ".", function(Char)
		Count += 1
		if Count % SpaceAmount == 0 then
			return `<font face = "{FontAdd.Name}">{Char}</font>`
		else
			return Char
		end
	end)
end

If text body was particularly large, we would maybe benefit from storing the modifications in a table and table.concat() at the return.