Commit Graph

24 Commits

Author SHA1 Message Date
Matthias Clasen
8581345acc Remove debug spew 2017-12-21 08:04:26 -05:00
Matthias Clasen
22f9562928 Implement font-feature-settings
This is a missing part of the CSS font level 3 module.
2017-12-20 10:31:30 -05:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Matthias Clasen
6859f0a6d1 css: Use enums instead of idents for font-variant properties
As Benjamin says, ident should only be used if any value
is valid, which is not the case here. So use enums instead,
which should also be more efficient. To handle the more
complicated cases like font-variant-ligatures, we have to
introduce flags-like values.
2017-09-18 23:22:38 -04:00
Matthias Clasen
f87dc24867 Fix a typo
The property is called font-variant-alternates, not -alternatives.
Correct this everywhere.
2017-09-18 18:10:08 -04:00
Matthias Clasen
b91f3ce331 css: Implement font-variant-east-asian
This is translated to the corresponding OpenType features.
2017-09-18 14:26:57 -04:00
Matthias Clasen
8a7f2ca0be css: Implement font-variant-alternatives
This is only a partial implementation, since we don't support
@font-feature-values. The only supported value is historical-forms,
for now.
2017-09-18 14:26:57 -04:00
Matthias Clasen
b99cb70299 css: Implement font-variant-numeric
This gets translated to the corresponding OpenType features.
2017-09-18 14:26:57 -04:00
Matthias Clasen
8525afc408 css: Implement font-variant-caps
This gets translated to the corresponding OpenType features.
2017-09-18 14:26:57 -04:00
Matthias Clasen
01ed84fbef css: Implement font-variant-position
This gets translated to the corresponding OpenType features.
2017-09-18 14:26:57 -04:00
Matthias Clasen
c4cbe5feca css: Implement font-variant-ligatures
This gets translated into corresponding OpenType features.
2017-09-18 14:26:57 -04:00
Matthias Clasen
cee4622567 css: Implement font-kerning
This gets translated to the OpenType feature kern.
2017-09-18 14:26:57 -04:00
Alexander Larsson
882290b479 Skip dynamic type check in css value getters
This gets called a lot during snapshotting, and this change
alone brings down snapshot time by almost 10% in a syntethic
snapshot test.
2017-01-11 09:20:30 +01:00
Matthias Clasen
db50849d79 Add a function to get a font from a css style
Similar in spirit to
gtk_style_context_get (ctx, state, "font", ...)
but avoids the need for a style context.
This will be used to for css-styled text rendering
from css subnodes.
2016-06-03 00:30:29 -04:00
Matthias Clasen
7b0929ad38 Add a function to turn a css style into pango attributes
This is _gtk_style_context_get_pango_attributes, decoupled
from the GtkStyleContext. This will be used to drive css-styled
text rendering from css subnodes of widgets, e.g. for the value
in GtkScale.
2016-06-03 00:26:55 -04:00
Cosimo Cecchi
a009a50239 cssstyle: fix a compiler warning 2016-01-03 17:20:06 -08:00
Matthias Clasen
cfa0884165 Improve formatting of CSS style prints
Add a newline after CSS properties, so things don't run into
each other.
2016-01-03 17:05:16 -05:00
Matthias Clasen
2e921691d9 Redo CSS style printing
Drop the custom style printing implementation in gtkcssnode.c and
instead reuse the existing gtk_css_style_print function, extending
it a bit to suit our needs.

Instead of computing values, just recognize initial values by
having no CSS section. Also do away with the show-initial flag, and
just always filter out initial values. The flag can come back when
it is needed.
2016-01-03 15:36:48 -05:00
Matthias Clasen
130fc6ce9b css style: Accumulate changes in place
This avoids allocating a temporary bitmask, and lets us
avoid some value comparisons altogether.
2015-09-28 06:29:51 -04:00
Benjamin Otte
759d8dafd9 cssstyle: Add gtk_css_style_is_static()
Gets rid of the need to do

  if (ANIMATED_STYLE() &&
      animated_style_is_static(ANIMATED_STYLE(style))
2015-03-18 15:23:33 +01:00
Benjamin Otte
3d1e2a0558 cssstyle: Add optimization
There is no difference between a style and itself.
2015-03-18 15:23:32 +01:00
Benjamin Otte
9645daf48f cssstyle: Move function from vfunc to static func
compute_dependencies() is only used internally by GtkCssStaticStyle,
so there's no need to have it elsewhere.
2015-01-07 14:26:47 +01:00
Benjamin Otte
4168e0385e cssstyle: Split into GtkCssStyle and GtkCssAnimatedStyle
GtkCssStyle is the base class to be used for all types of styles that do
exist.

GtkCssAnimatedStyle is the only implementation so far, that is exactly a
copy/paste of the old GtkCssStyle code.
2015-01-07 14:26:46 +01:00
Benjamin Otte
572f46067f cssstyle: Rename GtkCssComputedValues => GtkCssStyle
This is literally just renaming of the object (and the associated source
files). No other changes are in there.
2015-01-07 14:26:46 +01:00