I have some custom fonts that I have imported to my Font Book (I am using a macOS machine and am using XeTeX).
I can import those custom fonts with the answer written in Package for changing font with each letter?, but in that answer, it seems that a letter would use a custom font, but it doesn't change when the letter is repeated. I am looking for an answer that would change a letter as its use is iterated.
What do I mean by iterated? Say we are using Helvetica, Courier, and Comic Sans MS. And we are trying to write the sentence "Lorem amet consectetur elit".
- The e in Lorem would use the Helvetica font
- The e in amet would use the Comic Sans MS font
- The e in consectetur would use the Courier font
- The e in elit would use the Helvetica font
The order does not have to follow [Helvetica, Courier, and Comic Sans MS], I would like it to be random. In other words:
- The e in Lorem could use the Comic Sans MS font
- The e in amet could use the Courier font
- The e in consectetur could use the Helvetica font
- The e in elit could use the Courier font
is viable. What I aim to achieve is a document in which the letters of a sentence would randomly use a font style for a letter, and would change as the letter is used again. It does not follow a rigid way of using fonts.
It seems that that case has been answered in Randomized fonts for handwritten look (see the example image, particularly the äöüß part.)
With those answers, I tried to integrate the first answer (fontspec import ttf) into the second answer but it doesn't seem to work out, and would instead just use the default font.
In that image above, is the result of my integration of those two answers. I did \usepackage{fontspec}, \setmainfont{My-Custom-Font}, and set \pgfmathdeclarerandomlist{fontlist}{{lmr}{lmdh} into \pgfmathdeclarerandomlist{fontlist}{{my-custom-font}{lmdh}. my-custom-font is not the name of the font, just a placeholder.
It does not seem to be working, hence I'm asking this question here, I hope that I would get a viable answer, thank you so much.
PS: I tried to import my font like it was told in Package for changing font with each letter?, and it did work. I'm just confused as to how I can import my custom font like how I did in the first answer, and into a changing-font-as-it-iterates pattern like written in the second answer, where it seems that it imports the fontcode instead of the fontname (https://www.overleaf.com/learn/latex/font_typefaces).
Once again, thank you so much. I hope I am clear in explaining my issue.

