Closed Bug 760825 Opened 12 years ago Closed 5 years ago

The source editor: respect the system font size setting and text zoom shortcuts

Categories

(DevTools :: Source Editor, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: msucan, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: access, dev-doc-needed, Whiteboard: [accessibility][sourceeditor])

Attachments

(1 obsolete file)

Ubuntu features an option to change font sizes for the entire system. The source editor does not respect this option, while the rest of the Firefox UI respects the system setting.

I assume this problem is valid on other Linux distributions as well, perhaps even Mac and Windows systems - if we hard code font sizes in our UI.

Developer tools affected: the JavaScript debugger, Scratchpad and the Style Editor, along with any other extension that uses the source editor.
Whiteboard: [accessibility] → [accessibility][sourceeditor]
Assignee: nobody → mihai.sucan
Status: NEW → ASSIGNED
Depends on: 759351
Moving to Source Editor component.

Filter on CHELICERAE.
Component: Developer Tools → Developer Tools: Source Editor
Summary: The source editor does not respect the system font size setting → The source editor: respect the system font size setting and text zoom shortcuts
Attached patch proposed patch (obsolete) — Splinter Review
This makes using scratchpad, debugger and the style editor *much* nicer for me. Default font size is now easy to read and the new ctrl-+/- shortcuts come in very handy.

Looking forward to your comments.
Attachment #645854 - Flags: review?(rcampbell)
Depends on: 757071
No longer depends on: 759351
OS: Linux → All
New keyboard shortcuts need to be documented: Ctrl-0 (reset font size), Ctrl-+ (increase font size) and Ctrl-- (decrease font size).

New API needs to be documented: editor.fontSize getter and setter.
Keywords: dev-doc-needed
Blocks: 757016
Comment on attachment 645854 [details] [diff] [review]
proposed patch

+    action: "Increase font size",
+    code: Ci.nsIDOMKeyEvent.DOM_VK_ADD,
+    accel: true,
+  },
+  {
+    action: "Decrease font size",
+    code: Ci.nsIDOMKeyEvent.DOM_VK_SUBTRACT,
+    accel: true,
+  },
+  {
+    action: "Increase font size",
+    code: Ci.nsIDOMKeyEvent.DOM_VK_EQUALS,
+    accel: true,
+  },
+  {
+    action: "Decrease font size",
+    code: Ci.nsIDOMKeyEvent.DOM_VK_HYPHEN_MINUS,
+    accel: true,
+  },
+  {
+    action: "Increase font size",
+    code: Ci.nsIDOMKeyEvent.DOM_VK_PLUS,
+    accel: true,
+  },
+  {
+    action: "Decrease font size",
+    code: Ci.nsIDOMKeyEvent.DOM_VK_MINUS,
+    accel: true,
+  },
+  {
+    action: "Reset font size",
+    code: Ci.nsIDOMKeyEvent.DOM_VK_0,
+    accel: true,
+  },
+  {
+    action: "Reset font size",
+    code: Ci.nsIDOMKeyEvent.DOM_VK_NUMPAD0,
+    accel: true,
+  },

do we need that much duplication? I don't believe we do.
Attachment #645854 - Flags: review?(rcampbell)
(In reply to Rob Campbell [:rc] (:robcee) from comment #4)
> Comment on attachment 645854 [details] [diff] [review]
> proposed patch
> [...]
> 
> do we need that much duplication? I don't believe we do.

Good question. This comes from reading through the keybindings for page zoom in/out. We have 3 keys for each, zoom in and out, to cope with different layouts.
This new API is exactly what Firebug needs (Firebug also supports text zoom in its UI).

One question though. Firebug is maintaining its own preference for storing the current font-size (extensions.firebug.textSize) and I am not sure how much is the devtools.editor.fontsize pref wired into the default behavior of SourceEditor. 

I believe that changing font-size in SourceEditor instances used in Firebug should not affect those instances used in Firefox and vice versa. How is this suppose to work in the suggested patch?

Honza
(In reply to Jan Honza Odvarko from comment #6)
> This new API is exactly what Firebug needs (Firebug also supports text zoom
> in its UI).
> 
> One question though. Firebug is maintaining its own preference for storing
> the current font-size (extensions.firebug.textSize) and I am not sure how
> much is the devtools.editor.fontsize pref wired into the default behavior of
> SourceEditor. 
> 
> I believe that changing font-size in SourceEditor instances used in Firebug
> should not affect those instances used in Firefox and vice versa. How is
> this suppose to work in the suggested patch?

The pref is shared by all of the SourceEditor instances. So users who change the font size in scratchpad will see the new font size in the debugger, style editor, firebug, etc. The change is not applied live to other current instances. The change is reflected only when you start a new editor instance.

From the user's perspective, for me, this is fine (and what I expect): I usually have a comfortable font size for reading, and it does not change from one tool to another.

I suggest that firebug does not handle the font size in the source editor in any special way, actually. Let font sizes be managed by the editor. Albeit, I can see how this can go wrong with the existing text size options in Firebug... uh oh.

If you believe this is an important problem I could add a "persistence" option. One that would allow you to disable the automatic pref update.
(In reply to Mihai Sucan [:msucan] from comment #7)
> (In reply to Jan Honza Odvarko from comment #6)

> If you believe this is an important problem I could add a "persistence"
> option. One that would allow you to disable the automatic pref update.
Yes. I think Firebug UI-text zooming should be independent.

Note that Firebug UI is not only a source editor but also other components (like e.g. the Net panel) that needs to change the font size if the user says so. It could be weird if the user, for example, increases font in the Scratchpad and suddenly the Net panel changes the size too.

My feeling is that this feature should be somehow optional. Consumers (extensions) of the SourceEditor should be able to decide whether to activate automatic zooming or not and be able to incorporate own zooming logic. Note that the zoom factor/step can be different in other tools.

In the future, if some users prefer having one zoom for all installed dev tools/editors, those tools can listen for devtools.editor.fontsize changes and adjust their size accordingly. However such decision would be up to the tool.

Honza
Blocks: 819943
Blocks: 826685
It would be awesome if this could live at the toolbox level.
Blocks: 872390
Blocks: 858765
What's the plan on this given the switch to CodeMirror?
Flags: needinfo?(mihai.sucan)
(In reply to Anton Kovalyov (:anton) from comment #10)
> What's the plan on this given the switch to CodeMirror?

No plan has been made, however:

1. we now have toolbox-level zoom which is probably better than having different zooms for every tool/component. we removed the webconsole-specific zoom as well.

2. to respect the system font size setting one only needs to use a specific font-size: -moz-use-system-font. I would very much like this. All users who have configured their system for large (non-default) font sizes see inconsistencies in our devtools fonts - some are fixed sizes in pixels, others are relative to the system config.

I suggest morphing this bug towards fixing point 2. I find the default codemirror too small with my config. Thank you!


(unassigning myself because I am not actively working on this. I will reassign if/when I get back to the bug)
Assignee: mihai.sucan → nobody
Flags: needinfo?(mihai.sucan)
Priority: -- → P3
Status: ASSIGNED → NEW
Attachment #645854 - Attachment is obsolete: true
From a hacks.mozilla blog post:

opo wrote on April 6th, 2014 at 07:44:

> Don’t know why or how the font on my Firefox DevTools is so
> incredible small. I don’t see where from should I set to a
> normal value. Right now they are like 4-5px making the work
> with the scratchpad a headake.
> Thanks
> ( I use linux ( manjaro + xfce ) if it has any relevance )

https://hacks.mozilla.org/2014/03/box-model-highlighter-web-console-improvements-firefox-os-hud-more-firefox-developer-tools-episode-30/comment-page-1/#comment-2159624
Keywords: access
Product: Firefox → DevTools
Since we can do Ctrl-0 (reset font size), Ctrl-+ (increase font size) and Ctrl-- (decrease font size). In every devtools tab. Shouldn't this bug be closed?
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: