17 ms·
Idle thought - would it be possible using layers to do selectable text in an image - top layer is 100% transparent text, 2nd layer is the image. The font face i
by fragmede 16y ago
Idle thought - would it be possible using layers to do selectable text in an image - top layer is 100% transparent text, 2nd layer is the image. The font face is preserved (though it still won't wrap), but the text is still selectable for copy and paste.
- matthiaskramm 16y agoBrowsers are "smart"- they won't let you select text that's 100% transparent. 99% transparency works... but also looks kind of weird if the texts don't overlap perfectly. You can roll your own text selection in javascript (on top of the bitmap) if you know the glyph positions though- that's what e.g. Google Books does. It's a valid option if you don't care about zoomability.
- bd 16y agoAre you sure? I just made a quick test and it works ok in FF, Opera, Chrome, Safari, IE9 (Windows 7, Ubuntu 9.10): <body style="background:url(image.png)"> <span style="color:rgba(0,0,0,0)">Hello world</span> </body>
- joshd 16y agoThat's almost what Google Docs PDF viewer does. Each page is a JPG. This is served to the user with a catalogue of text layout then JavaScript is used to simulate selection and copying.
- vampirical 16y agoYep, you can do just that. Browsers that support rgba for text color make it quite easy and in older browsers you can do onselect tricks and the like to make it work.
- deleted 16y ago[deleted]