Re:How Scribd's HTML5 conversion works ... even when it shou...
by fragmede on Thursday August 26, 2010 @06:08PM
(#1637300)
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.
[ Parent
| on HN ]
Re:How Scribd's HTML5 conversion works ... even when it shou...
by matthiaskramm on Thursday August 26, 2010 @06:15PM
(#1637315)
Browsers 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.
Re:How Scribd's HTML5 conversion works ... even when it shou...
by bd on Thursday August 26, 2010 @06:28PM
(#1637349)
Are 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>
Re:How Scribd's HTML5 conversion works ... even when it shou...
by joshd on Thursday August 26, 2010 @06:50PM
(#1637392)
That'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.
Re:How Scribd's HTML5 conversion works ... even when it shou...
by vampirical on Thursday August 26, 2010 @08:03PM
(#1637589)
Yep, 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.