-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Update UI layout code for use of SVG icons #6977
Conversation
50 or 48 (144/3)? I'll take a look at what the size looks like later/tonight.
On Fri Dec 11 2020 10:01:16 GMT+0100 (Central European Standard Time), poire-z wrote:
Don't trust the icons' native sizes: replace scale_for_dpi=true with width = height= DGENERIC_ICON_SIZE, so all icons get the same (tunable) size - except in a few specific use cases.
I've put DGENERIC_ICON_SIZE = 50 to provoke a reaction :) as we need to decide a value for this.
More context around #6937 (comment)
This change is
You can view, comment on, or merge this pull request online at:
#6977
Commit Summary
Update UI layout code for use of SVG icons
File Changes
M .luacheckrc (1)
M defaults.lua (3)
M frontend/apps/filemanager/filemanager.lua (4)
M frontend/apps/reader/modules/readertoc.lua (17)
M frontend/apps/reader/modules/readerview.lua (4)
M frontend/ui/rendertext.lua (6)
M frontend/ui/widget/button.lua (6)
M frontend/ui/widget/configdialog.lua (6)
M frontend/ui/widget/confirmbox.lua (4)
M frontend/ui/widget/container/alphacontainer.lua (8)
M frontend/ui/widget/container/movablecontainer.lua (6)
M frontend/ui/widget/iconbutton.lua (7)
M frontend/ui/widget/imagewidget.lua (6)
M frontend/ui/widget/infomessage.lua (9)
M frontend/ui/widget/multiconfirmbox.lua (4)
M frontend/ui/widget/touchmenu.lua (3)
M spec/unit/defaults_spec.lua (16)
Patch Links:
https://github.com/koreader/koreader/pull/6977.patch
https://github.com/koreader/koreader/pull/6977.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
…--
Sent with the new, awesome Vivaldi mail client / browser. Download it at vivaldi.com.
|
I recommend 48 as that's 1) a standard icon size and 2) easier to scale up and down to other common sizes. |
Does that matter at this point ? It's the target size, so no scale up/down (unless scaleBySize would magically round things nicely with 48 as input?). |
Well, if we're going to actually render at 48px, it makes more sense to edit the SVGs at that size because then they'll be sharper (4px at 144px rendered at 48px will always be anti-aliased and fuzzy, and any lines not on a multiple of 3 pixel grid will be fuzzy too). Whether that's an issue depends on the device I think. On my Clara HD, it's pretty sharp anyway (might just be too small for my eyes). On the emulator (and Android maybe??) it's pretty fuzzy. Plus, if we go to 48px and round up from 4/3 to 2px, then we get thicker lines. |
The issue here is that the 48 @poire-z is talking about is not the 48px @johnbeard is talking about ^^. That 48 is fed through scaleBySize, which will then spit out an actual pixel value, which will most likely never ever be 48px ;). |
Oh right, I though it was going to change to be actually 48px (or some other value). Ignore me then, it doesn't matter what the SVG size is :-D |
Only on the emulator we'll render at 48px (may be only on my small one?). On my GloHD, I know my scale ratio: x 1.78667, so I'll have them at 85px. |
(But but but... can I still get thicker lines ? :) |
I don't think it's a relevant concern outside of computers with low-res monitors and very old devices, and it's not very bad on those either.
Something like 6px at 144 or 2 at 48 is fine by me. However, I wouldn't worry too much about what it looks like at 48 unless that happens to be exactly the value we like. Worry more about how it looks at 96 or 144. ;-) |
Are we talking thicker for all icons or just the Because if it's the latter, we should consider trying to figure out what the actual size ratio is so we can thicken those icons relative to the "normal" icons (e.g. zoom to page) so they come out at the same actual thickness on screen. |
Pretty sure we're talking about all icons.
…On Fri, Dec 11, 2020 at 4:47 PM John Beard ***@***.***> wrote:
Are we talking thicker for *all* icons or just the appbar icons which
render smaller (currently?)
Because if it's the latter, we should consider trying to figure out what
the actual size ratio is so we can thicken those icons relative to the
"normal" icons (e.g. zoom to page) so they come out at the same actual
thickness on screen.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6977 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABRQBMLHNB7QLZOEYJDQX3SUI5JDANCNFSM4UWJYZZA>
.
|
Smaller than what? Currently when ? So, we all should test from now on with this PR applied on our emulator and devices. |
Assuming you've not set a custom UI DPI, the
Or, if you've set a custom UI dpi and it doesn't match the device's:
On a H2O (1080x1429, 265 DPI):
On a Forma (1440x1920, 300 DPI):
EDIT: Fixed the maths xD. EDIT²: Again. |
Now that I've stopped mangling the maths, the explanation: it was designed to be 1:1 on the original 6" Vizplex screens: 600x800 @ 167dpi. (Especially compared to the 10.3" DX: 825x1200 @ 150dpi). |
Is there a logic about this distinction ? GloHD or ClaraHD (1448 x 1072 @ 300dpi):
|
I'm as puzzled as you are by that bit of logic every time I look at it ^^. (Which is why I almost always get it wrong each time I try to explain it ^^). It possibly coulda maybe have made sense at the time, but it's certainly fishy nowadays. |
Rabbit hole:
|
So, I guess it's time to make it right, if we are going to resize things around a bit :) |
Let's see what @Frenzie has to say about it, but I'd tend to agree, yeah ;). |
There's a little top vs bottom menu bar height difference, because of this span: koreader/frontend/ui/widget/touchmenu.lua Line 236 in 86701f6
So, we have to decide whether to kill that span at top, or add it at bottom. Also, this PR does not include the line thichness reduction from #6937 (comment) . |
While quite unlikely for a minor step like the example given, it's certainly possible that all kinds of things could suddenly gain an extra pixel. Your 2px line turns into a 3px line at some point. Setting aside the scaleBySize part of the equation:
Make what right, precisely? |
Note that we purposefully play with the above. 0.5px at 160 = 1px, all the way up to far above 320 dpi. It then makes 160 DPI a bit fatter than the look we're actually going for. |
Oh, I see what you mean. No, I think it's probably an oversight in custom DPI handling unless comments/git blame have anything pertinent to say. |
Looks a bit unbalanced to me. |
I'd be moderately inclined to have it in both menus, but no super strong opinion about it (e.g., keeping the bottom menu as small as possible has its merits, although we are talking about a very few pixels here, so, eh ;p). |
Yup, let's just stick to the same old size. ;-) |
OK. Now other comment, can I merge it? |
Oups, some small cleanup in Makefile needed (I only rgrep'ed for stuff in subdirectories...). |
Actually I noticed you're also removing the source files for the old icons. Please don't! ^_^ |
I'd like to |
You really want me to let them?
You'll have to rename a few of them to give them their new names. |
Yup! When I said PNG I meant PNG. :-) |
313f4ef
to
03d5b1e
Compare
OK, done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't read/test the alpha stuff in detail but seems fine while skimming.
Not much alpha stuff changed, but @NiLuJe will soon re tweak all that :) @NiLuJe : one little useless thing to check anyway for your blit/alpha stuff changes: the alphacontainer, that is only used with PDF by readerview for its arrow - when It's quite crappy, I remember I spent quite some time last week as the SVG stuff made it no more transparent. But well, rarely used, not important. |
@poire-z: I tried to submit a PR against your branch but I cannot locate your fork as a base. Anyway, it was to move platform specific resources outside shared icons: diff --git a/Makefile b/Makefile
index 453757ef..17722647 100644
--- a/Makefile
+++ b/Makefile
@@ -383,7 +383,6 @@ androidupdate: all
-xr!*NOTES.txt$ \
-xr!*NOTICE$ \
-xr!*README.md$ \
- -xr!*koreader.icns$ \
-xr'!.*'
# make the android APK
@@ -427,7 +426,7 @@ macosupdate: all
$(INSTALL_DIR)/bundle/Contents/MacOS \
$(INSTALL_DIR)/bundle/Contents/Resources
- cp resources/koreader.icns $(INSTALL_DIR)/bundle/Contents/Resources/icon.icns
+ cp $(MACOS_DIR)koreader.icns $(INSTALL_DIR)/bundle/Contents/Resources/icon.icns
cp -LR $(INSTALL_DIR)/koreader $(INSTALL_DIR)/bundle/Contents
cp -pRv $(MACOS_DIR)/menu.xml $(INSTALL_DIR)/bundle/Contents/MainMenu.xib
ibtool --compile "$(INSTALL_DIR)/bundle/Contents/Resources/Base.lproj/MainMenu.nib" "$(INSTALL_DIR)/bundle/Contents/MainMenu.xib"
diff --git a/platform/mac/do_mac_bundle.sh b/platform/mac/do_mac_bundle.sh
index 02fcb400..933ab349 100755
--- a/platform/mac/do_mac_bundle.sh
+++ b/platform/mac/do_mac_bundle.sh
@@ -160,8 +160,7 @@ rm -rf cache clipboard history ota \
l10n/.git l10n/.tx l10n/templates l10n/LICENSE l10n/Makefile l10n/README.md \
plugins/SSH.koplugin plugins/hello.koplugin plugins/timesync.koplugin \
plugins/autofrontlight.koplugin resources/fonts resources/icons/src \
- resources/kobo-touch-probe.png resources/koreader.icns rocks/bin \
- rocks/lib/luarocks screenshots spec tools
+ rocks/bin rocks/lib/luarocks screenshots spec tools
# adjust reader.lua a bit.
diff --git a/resources/kobo-touch-probe.png b/resources/kobo-touch-probe.png
deleted file mode 100644
index d34260f7..00000000
Binary files a/resources/kobo-touch-probe.png and /dev/null differ
diff --git a/resources/koreader.icns b/resources/koreader.icns
deleted file mode 100644
index 97dd63f0..00000000
Binary files a/resources/koreader.icns and /dev/null differ
diff --git a/tools/kobo_touch_probe.lua b/tools/kobo_touch_probe.lua
index 7e2cf675..673ec778 100755
--- a/tools/kobo_touch_probe.lua
+++ b/tools/kobo_touch_probe.lua
@@ -51,7 +51,7 @@ function TouchProbe:init()
},
}
self.image_widget = ImageWidget:new{
- file = "resources/kobo-touch-probe.png",
+ file = "tools/kobo-touch-probe.png",
}
local screen_w, screen_h = Screen:getWidth(), Screen:getHeight()
local img_w, img_h = self.image_widget:getSize().w, self.image_widget:getSize().h |
OK, I'm applying it, thanks. |
(Just changed your |
Also move Mac specific resource in platform/mac/.
aef7e73
to
8b348ee
Compare
@NiLuJe : I haven't thought/I forgot about the inverted colors in nightmode: |
@poire-z
|
@poire-z: Nope, colors have to be inverted or the B&W stuff doesn't work ;). (You'd need to single out actually color icons, don't composite 'em, and treat them almost like classic images, but not quite, i.e., with an extra invert in NM before blending. Which would then break highlighting for those ;). And needs a copy to not affect the cache). |
You probably did |
I always use |
|
||
-- Directories to look for icons by name, with any of the accepted suffixes | ||
local ICONS_DIRS = {} | ||
local user_icons_dir = DataStorage:getSettingsDir() .. "/icons" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should be DataStorage:getDataDir()
instead of DataStorage:getSettingsDir()
.
(koreader/icons/
instead of koreader/settings/icons/
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it doesn't seem to have much to do with settings.
Should be `DataStorage:getDataDir()` instead of `DataStorage:getSettingsDir()`. (`koreader/icons/` instead of `koreader/settings/icons/`) #6977 (comment)
* Make sure scaleBySize *always* honors a DPI override, even if it's set to the native DPI... As discussed in koreader/koreader#6977 * Allow clearing a DPI override Useful when switching from a custom DPI to the native one. * Plug clearDPI into setDPI if it gets a nil (As that's what front does)
Don't trust the icons' native sizes: replace
scale_for_dpi=true
withwidth = height= DGENERIC_ICON_SIZE
, so all icons get the same (tunable) size - except in a few specific use cases.I've put
DGENERIC_ICON_SIZE = 50
(updated to 48) to provoke a reaction :) as we need to decide a value for this.More context around #6937 (comment)
This change is