Skip to content

Commit

Permalink
Change font size settings to pixels
Browse files Browse the repository at this point in the history
WebKit only accepts integer px. So it would be hard to control if the
settings are in fractional pt.

Also change max size settings to uint, as they currently don't support
-1.
  • Loading branch information
johnfactotum committed Jun 3, 2023
1 parent 6c7f366 commit 10ab3a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions data/com.github.johnfactotum.Foliate.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@
<key name="gap" type="d">
<default>0.06</default>
</key>
<key name="max-inline-size" type="i">
<key name="max-inline-size" type="u">
<default>720</default>
</key>
<key name="max-block-size" type="i">
<key name="max-block-size" type="u">
<default>1440</default>
</key>
<key name="max-column-count" type="i">
<key name="max-column-count" type="u">
<default>2</default>
</key>
<key name="scrolled" type="b">
Expand All @@ -92,10 +92,10 @@
<key name="default" type="u">
<default>0</default>
</key>
<key name="default-size" type="d">
<default>12</default>
<key name="default-size" type="u">
<default>16</default>
</key>
<key name="minimum-size" type="d">
<key name="minimum-size" type="u">
<default>0</default>
</key>
</schema>
Expand Down
6 changes: 3 additions & 3 deletions src/book-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ GObject.registerClass({
'sans-serif': 'Sans 12',
'monospace': 'Monospace 12',
'default': 'serif',
'default-size': 12,
'default-size': 16,
})
viewSettings = new ViewSettings({
'brightness': 1,
Expand Down Expand Up @@ -341,9 +341,9 @@ GObject.registerClass({
monospace_font_family: getFamily(font.monospace),
default_font_family: getFamily(font.default === 1
? font.sans_serif : font.serif),
default_font_size: WebKit.Settings.font_size_to_pixels(font.default_size),
default_font_size: font.default_size,
// TODO: disable this for fixed-layout
minimum_font_size: WebKit.Settings.font_size_to_pixels(font.minimum_size),
minimum_font_size: font.minimum_size,
})
const view = this.viewSettings
if (this.#bookReady) await this.#exec('reader.setAppearance', {
Expand Down

0 comments on commit 10ab3a3

Please sign in to comment.