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

Amount of text per page #2

Open
Wowfunhappy opened this issue May 20, 2019 · 2 comments
Open

Amount of text per page #2

Wowfunhappy opened this issue May 20, 2019 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@Wowfunhappy
Copy link
Owner

I'm currently using a conservative limit of 80 characters per page (plus or minus some for special conditions), but this isn't great in all situations, due to variable character widths and line wrapping.

Is there a better way?

@Wowfunhappy Wowfunhappy added the help wanted Extra attention is needed label May 20, 2019
@Wowfunhappy
Copy link
Owner Author

Wowfunhappy commented Sep 13, 2019

It is quite clear that this cannot be done with PebbleJS alone. However, there is an interesting line in simply_ui.c:

else if (!self->ui_layer.custom_body_font && body_size.h > body_rect.size.h) {
      body_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);

I am quite sure this code says: "If the text does not fit in the window, lower the font size to FONT_KEY_GOTHIC_18_BOLD". I know, because I can replace FONT_KEY_GOTHIC_18_BOLD to change what font is used whenever there's too much text in an un-scrollable window. The PebbleJS default is actually FONT_KEY_GOTHIC_18, I changed to FONT_KEY_GOTHIC_18_BOLD for this app to make the size switches less jarring.

Instead of changing the body font, would it be possible to set a variable that can be read from SimplyJS? Unfortunately, I don't know C...

@Wowfunhappy
Copy link
Owner Author

I thought of a way I could do this with Javascript. Track the width of each word, by giving each letter a "score" based on its width (or just 1 in initial iteration). If the width of each word is greater than a predefined limit, increment the line. Once you have too many lines (I think the limit is 6?), go to the next page.

It's totally doable, but writing the code is going to make my brain hurt, so don't expect it soon...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant