05-01-2015, 02:45 PM | #1 |
Member
Posts: 12
Karma: 10
Join Date: May 2013
Device: none
|
Is it possible to create hidden, searchable highlightable text?
My request might be impossible, but since I generally suck at HTML and CSS, I'd better ask before giving up.
I'm preparing an EPUB with a lot of key elements with variant spellings. Let's say, I wirite a text containing the word "colour", and that word should be fully text searchable within the (long) text. Now, among my target audience there might be some americans prone to search for the "colour" word using their own spelling "color". I would very much like to acommodate that, so I have been experimenting with various formatting options. Best results obtained so far seems to be with this code: Code:
colour<span style="font-size:0">color</span> I wonder if this could be obtained by a mixture of overlapping and transparent text elements, but my skills are sorely inadequate for the task, and intense googling around hasn't brought up any hints. What say you? Totally impossible? |
05-01-2015, 02:51 PM | #2 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
The appropriate way to deal with this is for UK/US versions of the book.
There is no way stick both words there, and your workaround is probably the best you can do -- and will cause curated search results to look mildly bizarre. |
Advert | |
|
05-01-2015, 03:46 PM | #3 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Searching might be possible, highlighting, if possible at all, depends on the reading software being used.
I would: 1. Dislike a reader finding and highlighting "color" when I search for "colour". 2. Welcome some search "fuzziness" options, like accent-insensitive, curly/straight quotes, or, why not, variant spellings... but this should be done by the software performing the search, not in the book! |
05-01-2015, 04:12 PM | #4 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Fuzzy searching that handles variant spelling would be a pretty cool feature in the ereader engine. I thought of that, but AFAIK nobody does this (yet).
I do know the Kindle (fw5.3.7) has fuzzy searching that handles inflections. Maybe there is hope. Or maybe later firmware that I haven't seen already does that. |
05-02-2015, 06:33 AM | #5 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
I would simply spell the word as color, having never met a Brit who wasn't aware of American spelling and usage, whereas even in the era of Harry Potter few Americans will tolerate British usage. (The Rowling books are translated for the US market.) I even sense that American usage in punctuation is infiltrating the British book world (double quotes, punctuation inside the close-quote).
|
Advert | |
|
05-02-2015, 10:43 AM | #6 | |
Member
Posts: 12
Karma: 10
Join Date: May 2013
Device: none
|
Quote:
Another project, I'm trying to get ahead with is a latin text. Her, I'd like to have some stress-markers in the text, but have them basically invisible for the purpose of text searching. Example: the latin word sapie'ntior is marked here with an "apostrophe" after the vowel, that should be stressed, e.g. sapiENtior. Nevertheless, I'd like the word to be looked up searching for just sapientior. I have been pondering over how to achieve this, and my best guess so far has been a span of a sort styled as "stressed" which may trigger a font substitution, where the vowels would have said stress-apostrophes as a part of the vowel itself: Code:
sapi<span style="stressed">e</span>ntior Anyone know how to put alternative fonts within an EPUB? Would probably have to replace the reader's default font as well, so the alternative font would not look too far apart. |
|
05-02-2015, 10:56 AM | #7 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Embedding fonts is a standard technique, you can find plenty of information around. But note that the <span> may break both searching and hyphenation, depending on the engine.
You could abuse fonts in a similar way, but map, for instance, "é" to your "e + apostrophe", assuming you don't have other "é"s in your Latin words, and then use <span class="whatever">sapiéntor</span> (or simply use accents to mark the stress, as is already done in a number of languages). Then you'd need the reader to support diacritic-insensitive searches, maybe some do already. |
05-02-2015, 11:35 PM | #8 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I have to wonder how worth it this is anyway, surely that is (again) the job of the ereader renderer.
The good news is that the Kindle, at least, supports exactly this fuzzy (diacritic-agnostic) searching. Hopefully other ereaders do as well. Just include the word with the appropriate diacritics and stop worrying. |
05-04-2015, 08:30 AM | #9 | |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
For example: Spoiler:
If you're planning to write a couple of Latin textbooks it might make sense to create a custom font in which all regular Latin lowercase characters have an acute accent. Since the Latin Extended-A and Latin Extended-B Unicode ranges already contain precomposed glyphs with acutes, all you'd have to do is overwrite the regular Latin glyphs with these characters. This can be easily done with a freeware font editor, e.g. Type light. |
|
05-05-2015, 01:57 AM | #10 |
Curmudgeon
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
I'm fairly certain that anything based on the WebKit rendering engine does, and that covers just about every recent reader except for the ones that are based on ADE/RMSDK. So if ADE works, then you're golden.
|
05-05-2015, 02:25 AM | #11 | |
Curmudgeon
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
Quote:
You might be able to work around that bug by adding a zero-width nonbreaking space at the tag boundaries, but then you probably won't be able to find the word in any reader, because there will be whitespace within the word.... If you want to go a little bit nuts, you might be able to get away with something like this: Code:
<span style="display: inline-block; width: 0; color: rgba(0,0,0,0.0); visibility: hidden;">hominibus</span>homínibus Basically, I'm pretty sure there's no way to hack this that won't cause even bigger problems, and even if there is a way, it really isn't a good idea. Just use the proper UTF-8 characters for the accented versions of the characters. It should "just work". Last edited by dgatwood; 05-05-2015 at 02:27 AM. |
|
05-05-2015, 05:14 AM | #12 | |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
I've slapped together a proof-of-concept ePub with a Charis SIL based custom font that contains only the letters á, é, í, ó, ú and ý; it works fine with iBooks, ADE 1.7.2 - 4.0.3, ADE-based iOS apps and CoolReader. Last edited by Doitsu; 05-05-2015 at 05:17 AM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is it possible to create interlinear text epubs? | Doitsu | ePub | 8 | 05-24-2012 11:12 AM |
PDF Conversion doesn't see hidden text | Bearbait | Conversion | 3 | 02-18-2011 02:56 PM |
How to create text frame | superanima | ePub | 1 | 12-12-2010 04:19 PM |
PDFs and Hidden Text Layers | aidren | enTourage Archive | 4 | 04-14-2010 01:23 PM |
BookDesigner - How to create a hidden ToC? | komugi | Reading and Management | 3 | 07-21-2009 01:12 PM |