AdjustFontSize-Xcode-Plugin icon indicating copy to clipboard operation
AdjustFontSize-Xcode-Plugin copied to clipboard

Is it possible to have different font sizes in different Xcode windows?

Open MoridinBG opened this issue 7 years ago • 4 comments

Do you think that this is possible? I might be interested in implementing it.

MoridinBG avatar Dec 22 '16 19:12 MoridinBG

Hey Ivan, thanks for the interest! Technically it should be possible, but the way it works is super-hacky: Xcode doesn't have a separate support for font-size. It is part of the themes (the ones from the preference pane → themes). It means you might have 2 problems:

  1. Come up with a good persistent identifier for a window (I guess you can use project path or something like that)
  2. Make sure you are detecting switching to different windows and switching to various copies of the same theme that differ only by the font size.

To illustrate, let's say you have a theme called "Default".

  1. Now whenever you switch to a new window you'll need to check if this window's identifier has a theme associated with it.
  2. If not, use "Default", otherwise switch to "Default-1" (assuming that's the theme name + unique id)
  3. Whenever adjusting font size, you want to check if you are using "Default" theme. If so, clone it and adjust font size in "Default-2"

Technically it should be doable (although I found adjusting all the fonts included in the theme file takes human-perceivable amount of time). But if you go ahead implementing it, I'd like to keep the existing behavior as an option, since I personally prefer switching font size globally.

Let me know if you want to bounce any ideas of of me or have any further questions 👍

zats avatar Dec 22 '16 19:12 zats

Hey, that is exactly what I wanted to know. My use case is for working with a laptop + external monitor. The external is 23" 1080p, the laptop is 15" rMBP @1680x1050. On the laptop the font is close to 2x smaller.

What you suggest is to switch the Xcode theme when the windows are switched. But this will redraw all windows with the new theme? I want to achieve multiple visible windows with different font sizes on each.

MoridinBG avatar Dec 22 '16 20:12 MoridinBG

yeah that's pretty much the only solution I know of, you would have to clone existent theme for each window and change the font size in the cloned theme so it won't affect the other windows. Also given that you'll be cloning them programmatically, chances that anyone else is using your theme are low. It is quite messy but the only solution I know of.

I developed this in the time of Xcode 7, it is possible Xcode 8 changed the internals (although I doubt it)

zats avatar Dec 22 '16 20:12 zats

@MoridinBG consider closing the issue if it answered your question

zats avatar Dec 27 '16 05:12 zats