Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a CSS hack to add accents to preserve selected words #7

Open
1over137 opened this issue Apr 25, 2022 · 4 comments
Open

Use a CSS hack to add accents to preserve selected words #7

1over137 opened this issue Apr 25, 2022 · 4 comments
Assignees

Comments

@1over137
Copy link

1over137 commented Apr 25, 2022

Hello
This software seems to physically add the accents on the words themselves. This requires that the user has special dictionary programs or files which can handle the words in their accented forms. I propose a possible way to add accents without needing special dictionaries.
We use a CSS ::before property to provide the accented character in a zero width inline-block span. The text generated by CSS is not selectable, at least in all the browsers I tested. It also works in Calibre and Foliate, partially in KOReader (it does not select as a whole word, but you can just drag a bit). It might work with all reader software, but it still seems useful.
Example html:

<html>
  <head>
    <style>
    [data-content]::before {
      content: attr(data-content); 
    }
    </style>
  </head>
  <body>
    нали<span data-content='&#x301;'></span>чный
  </body>
</html>

This should display нали́чный, but if you try to select it, it will select наличный (without the accent)
It would be great if this is an option for this tool!

@1over137
Copy link
Author

Test epub:
https://ufile.io/3ofjqfjn

@Vuizur
Copy link
Owner

Vuizur commented Apr 26, 2022

This is a good idea, I'll look into it. I also tested it for Kindle, but they strip custom CSS there (or something like that), so it doesn't work there (which would have been nice because their annoying fuzzy lookup accent breaks dictionaries when the words contain combining acute accents).

@Vuizur Vuizur self-assigned this Feb 25, 2023
@equwal
Copy link

equwal commented Feb 18, 2024

With KOReader's dictionary it seems to work fine. So a workaround could be to flash your device with KOReader.

@equwal
Copy link

equwal commented Feb 18, 2024

This resolves the font bug I have

#15

Although at the cost of putting the stress mark just slightly off-center.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants