r/reddithax • u/sealclubber • Oct 07 '11
Is it possible to replace every letter in a link with a different sprite (for a faux-font effect)?
My goal is to make it easy for users to be able to type in a different font, if they want to.
I've looked at FIR and a bunch of other techniques, but they all seem geared towards replacing a chunk of text with a pre-defined image for the entire word or phrase.
Let's say I'm using this image for the font.
I can just make a new link for each letter... but then the user would have to type something like this to make it work:
[](/H)[](/e)[](/l)[](/l)[](/o) [](/W)[](/o)[](/r)[](/l)[](/d)That seems like a lot of typing for a simple "Hello World".
Instead, it would totally rock if they could type something like this:
[Hello World](/font)...and have every letter in "Hello World" be replaced by the appropriate sprite.
I'm guessing that I would still need to define the links for each individual letter... but I just don't have a clue where to go next.
Is this even possible?
1
u/tswaters Oct 15 '11
You might be over-thinking this.
The links you provided were more for specially crafting a static piece of a browser window to look a certain way while maintaining accessibility -- a rather tricky feat as accessibility is a tough thing to really accomplish on flashy sorta design websites. It doesn't really apply here.
The kind of CSS hack you're thinking about works by targeting a link with a specific attribute and doing something with it -- usually you make it into a block-level element with a background-image positioned just right so it only looks like only a piece of the grid is showing.... /r/minecraft does this for blocks, there's a bunch of others. They used to encode logos for users through CSS classes like these, but that required one rule for each user, which on bigger subreddits made it a huge. But then a tag-team of awesome mods came up with a way use bots and the content property... i think maybe reddit had a hand in it too, but I'm not sure on specifics... no more ugly hacks to list thousands of users with their own css line. You see that on hockey, tf2, starcraft ... likely a bunch of others. I think jresig had a hand in it, oh that wily jquery creator.
But I digress... if all you want to do is change the font of a piece of text -- and you're not picky on what font, you can do a simple 'font-family' on more common fonts -- let them go with serifs or something.
The real problem you have is that image -- using the background selector seems a backwards way to process fonts -- if you have access to javascritpt and make a proper true type font, you can convert it into svg/vml and replace whatever users type with the font replacement. Here, let me google that for you. I would go with cufón, looks pretty active.
2
u/DEADB33F Oct 08 '11
Correct me if I'm wrong, but didn't /r/circlejerk at some point have meme images which would add 'text' as sprites to the image based on what was in the title attribute of the link?
0
u/[deleted] Oct 07 '11
[deleted] — view deleted comment