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

Faces for book contents #6

Open
vlichevsky opened this issue Nov 12, 2021 · 10 comments
Open

Faces for book contents #6

vlichevsky opened this issue Nov 12, 2021 · 10 comments
Labels
enhancement New feature or request

Comments

@vlichevsky
Copy link

It would be very nice to have the ability to customize the look of main body of text, titles, chapters, etc. via faces.

@jumper047 jumper047 added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Nov 12, 2021
@vlichevsky
Copy link
Author

Hi. I just checked the implementation of styling via faces and it doesn't seem to work. Or is it just not finished yet? Also, IMHO fb2-reader-default face should inherit from variable-pitch face. Monospace fonts are not very well suited for long texts.

@jumper047
Copy link
Owner

It is still work in progress, but basic things should work though. Just tested - M-x customize-face fb2-reader-default-face works as expected. Can you provide sequence of actions to reproduce an issue? Regarding variable-pitch - I'm afraid proportional fonts will broke my workarounds to get centered titles of non default height, so there is some test needed (seems like I broke somehow fonts on my book, variable-pitch-mode command have no effect on me:( ). But I thought you could just set it by yourself and add variable-pitch-mode to fb2-reader-mode-hook?

@jumper047
Copy link
Owner

Just checked it - readability definitely improved, but overall look gotten worse - formatting tricks I used (fill-region etc) don't play well with proportional fonts. I'll try to improve that in future.

@vlichevsky
Copy link
Author

Can you provide sequence of actions to reproduce an issue?

Excerpt from my color theme:

   `(fb2-reader-default     ((,class (:inherit variable-pitch :height 1.2))))
   `(fb2-reader-title       ((,class (:inherit fb2-reader-default :height 1.4 :weight bold))))

Customized faces look right in list-faces-display output, but the look of books doesn't change. If I enable variable-pitch-mode the font becomes variable-pitch, but :height doesn't change.

@vlichevsky
Copy link
Author

I just checked the implementation of styling via faces and it doesn't seem to work.

I have found the culprit. I have (global-whitespace-mode) in my Emacs config and it messes up faces in fb2-reader-mode. When whitespace-mode is disabled in fb2-reader (it is unnecessary in it anyway) faces are fixed, but lines are chopped again from the right side.

@jumper047
Copy link
Owner

I suppose it's because of :height>1 - I don't took it into account in text blocks. Added to my todos.

@jumper047
Copy link
Owner

I updated the plugin - now all basic fb2 tags are customizable, and their heights are taken into account - the issue with chopped lines should be fixed now. Another good thing about it is more decent support for variable-width fonts. There are no built-in functions to justify such regions. But with the latest changes, it is possible at least align all tags to left - so their appearance will be a lot prettier than before

@vlichevsky
Copy link
Author

With recent changes lines aren't chopped anymore, but I've noticed another thing. I set fb2-reader-page-width to 80, but get only 62 characters per line.

@jumper047
Copy link
Owner

jumper047 commented Dec 14, 2021

fb2-reader-page-width is width measured in normal-sized symbols. Actual width recalculated for every text block as fb2-reader-page-width divided by face's height (in fact it is calculated as the multiplication of all heights in face's inheritance chain, so if your title face has a height of 1.4 and default face have a height of 1.2 your overall height will be calculated as 1.4*1.2).

@jumper047
Copy link
Owner

I think I should add this explanation to variable's docstring:).

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

No branches or pull requests

2 participants