Ok, so, it’s been a month.
The text properties docker branch got merged. However…
- it is still very buggy, with all sorts of UI paper cuts all over the place. As said before, I need to polish everything now.
- If you are going to test it, note that right now, in the text tool, if you have no selection you are editing paragraph wide properties, and if you have a selection you’re editing properties in that range.
We’re not particularly happy with this interaction mechanism just yet, and my hope is that after I have fixed all the main bugs and papercuts, we have a testing round again. And in that testing round we’ll decide together on what would be better. Before that however, together with the bugfixes I’ll be doing my promised feature introductions, because otherwise the different issues I’m bumping into may seem too abstract.
Which brings us to the first introduction:
Font Selection Properties.
This covers the main font family selection and the sub styles. To get this to work properly, I needed to do a ton of background work, as there’s like, 5 different ways fonts describe their relationship to one another. I’ve written a blogpost discussing all those technical bits.
There’s two main widgets associated with font selection. The font family group, and the font style group, both groups are collapsible, with a main widget “above the fold”, so to speak, controlling the main feature, and advanced options underneath the fold.
For font family, the main feature controls the first font family in the font family list. CSS requires that if a font is missing a glyph, it tries to select a different font. The font family list gives control over which font families it tries to fallback to.
This is mostly useful for mixed script situations, where selecting a fallback font can allow you to select a font that more closely matches the tradition of the main font.
The font families themselves have been made into resources. This means that they can be tagged and searched the same way as other resources. There’s a nice big preview available, and if the font has names for the locale you’re using Krita in, it will display those too.
As you can see, there’s a number of icons at the bottom. These are to indicate what kind of font we’re dealing with, like PostScript or OpenType or variable or color. It currently has some placeholder icons in place.
Question: Do you guys want to help me with better icons here? Should I make a new thread for that?
Then, for the font style. The main widget is a dropdown with style values as you may know them from other programs. These are either sub family fonts, or variable font instances. Selecting one of these sets up the appropriate CSS font property values in the advanced settings.
There’s 4 major font properties:
Weight controls how “heavy” the font looks. It goes from 0 to 1000, with 400 being regular and 700 being bold. This one can be synthesized, and I’ve added a button to turn off synthesis.
Width controls whether an expanded or condensed version of the font is selected. I’m not allowed to synthesize this. This was also the troublesome feature when using Qt’s font stuff, as that didn’t report the width of a selected font correctly, leading to things like Futura Condensed or Bahnschrift Condensed not being selectable. That’s fixed now.
Slant controls whether we’re using the upright, italic or the oblique version of a font, and in the case of oblique, how strong the angle is. The latter is only used by variable fonts like Roboto Flex. Here too is an extra toggle to turn off font-synthesis (which just applies a slanting transform to the glyphs).
Then there’s the Optical Size toggle. Some variable fonts have different glyphs for different sizes. The smaller size glyphs tend to be less delicate and easier to read, while bigger size glyphs are more detailed. This toggle controls whether to automatically scale this with the current font size.
Finally, there’s the extra axes list. This too is for variable fonts. In this example Junicode VF has an extra Enlarge axis, that changes how big the x-height is. Optical size, if available is also in this list.
These are always decided upon by the font creator, as is the label for it (these too, are localized, as are the style names), which means that for a font like Roboto Flex, which has quite a few of these extra axes, the font designer apparantly couldn’t be bothered to name them nicely:
So, this one is gonna take a while to merge, because there’s all sorts of weird edge cases I am bumping into. The next property I want to tackle after this (and then introduce) are font-size and line-height, which still have some unit problems.