Commit Graph

151 Commits

Author SHA1 Message Date
Matthias Clasen
eaa6301e53 Port the font chooser to just use harfbuzz 2019-11-01 13:01:54 -04:00
Timm Bäder
1b4bce4182 fontchooserwidget: Use a bin layout 2019-09-25 17:51:52 +02:00
Matthias Clasen
7f65e5f96b Rename GtkGestureMultiPress to GtkGestureClick
The name just made it hard for people to find the
right gesture to use.
2019-05-29 17:10:46 +00:00
Matthias Clasen
7447abb52b Stop using gtk_widget_get_toplevel
All uses of it can be replaced by gtk_widget_get_root.
2019-05-28 20:25:16 +00:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Matthias Clasen
27f854042d font chooser widget: Drop the priv pointer 2019-05-27 22:27:47 -04:00
Matthias Clasen
1b34e15893 font chooser widget: Make final 2019-05-28 00:56:41 +00:00
Matthias Clasen
965d0e04d1 gtk: Use root/unroot instead of display-changed
The display-changed signal is going away
2019-05-02 01:33:41 +00:00
Matthias Clasen
6277f2fccc fontchooser: Fix type-to-search
The key capture was interfering with other
entries in the dialog, so be smarter about
when we want to capture keys and when we
don't.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1842
2019-04-27 15:59:45 +00:00
Emmanuele Bassi
daea92ea00 Ignore deprecated HarfBuzz API
HarfBuzz 2.0 deprecated some API used by the GtkFontChooser, but since
we're still supporting older versions of HarfBuzz, we should disable the
deprecation warnings to avoid too much noise during builds.
2019-04-13 14:30:09 +01:00
Matthias Clasen
9e0c471b03 entry, spin button: Drop redundant API
Avoid duplicating GtkEditable APIs. Port existing users.
2019-02-28 16:34:00 -05:00
Matthias Clasen
37b841b59b font chooser: Use editable api on search entry 2019-02-19 00:25:59 -05:00
Timm Bäder
7aa02b9e95 Merge branch 'include-ft2build.h' into 'master'
font chooser: Properly include freetype headers

Closes #1432

See merge request GNOME/gtk!413
2018-11-14 13:30:28 +00:00
Timm Bäder
359d874ddb Use g_clear_pointer to unparent widgets 2018-11-13 20:53:14 +01:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Leonardo Taccari
b3ba2961d2 font chooser: Properly include freetype headers
freetype headers should be included via <ft2build.h> and then
indirectly via FT_*_H macros.

Fixes issue #1432.
2018-11-09 22:13:30 +01:00
Matthias Clasen
c1de6219ed font chooser: Remove an unneeded ifdef
We can just always create the axes hashtable.
2018-08-15 14:52:37 -07:00
Carlos Garnacho
3eb1b22651 gtkfontchooser: Use GtkEventControllerKey
Use an event controller on GtkFontChooserDialog, a nice side effect
is that we can use gtk_event_controller_key_forward() and
gtk_search_entry_set_key_capture_widget() instead of passing events
around for dialog search.
2018-06-21 12:50:57 +02:00
Timm Bäder
99099a1053 Remove some unnecessary snapshot implementations 2018-06-20 20:47:18 +02:00
Benjamin Otte
74dbb057ed eventcontrollerscroll: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
4ddc94b293 multipressgesture: Port to new API model 2018-04-26 17:59:42 +02:00
Matthias Clasen
d48084dad9 font chooser: Allow tweaking fractions
This makes some sense, and frac is meant to be set globally.
2018-04-14 20:28:27 -04:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Matthias Clasen
bd9debe048 font chooser: Remove some dead code
This is leftover code from already removed debug spew.
2018-04-02 17:46:41 -04:00
Matthias Clasen
5a68ac27cf font chooser: Make the language property writable
This is meant as an input to the font chooser.
We don't want the user to select a language, but
rather have fonts presented as they would work for
the current language. Therefore, do away with the
lang/script combo on the tweak page.
2018-04-02 13:37:53 -04:00
Chun-wei Fan
464943e5a6 gtk, demos: Fix builds without HarfBuzz and PangoFT
Really exclude the portions in the gtkfontchooserwidget.c that are built
when HarfBuzz and PangoFT2 are built, and update the Meson files to
exclude such sources as well from the main GTK SO/DLL and from the
gtk4-demo program.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-02 19:15:18 +08:00
Matthias Clasen
d0e46d257c font chooser: Add examples for font features
For some font features, we can figure out affected
glyphs, and show before/after. For some others, we
hardcode typical sequences.

Still to do: figure out how to find ligatures and
show them.
2018-04-01 19:36:54 -04:00
Matthias Clasen
ad814509a4 font chooser: Align level value names
In the backport, I used the plural for variations, and that
is a better name, so use it here too.
2018-03-31 21:02:51 -04:00
Matthias Clasen
d15a29c876 Defeat compiler optimization
We always want to call both update functions here, and
the compiler unhelpfully optimizes out the second call
if the first one returns TRUE.
2018-03-31 21:02:51 -04:00
Matthias Clasen
b1b05bee53 font chooser: Make levels flags
Turn the GtkFontChooserLevel field into flags, and
add flags for OpenType variations and features. The
motivation for this is to make font-features in the UI
opt-in, since applications need to support them by
applying the pango attribute.
2018-03-27 16:14:21 -04:00
Matthias Clasen
85a7d0a201 font chooser widget: Expose tweak-action as property
This is necessary for applications that want to embed
the font chooser widget outside of GtkFontChooserDialog,
in order to access the tweak page.
2018-03-27 16:14:21 -04:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Matthias Clasen
7e491fd3fc font chooser: Stop using ::scroll-event
We have an event controller for this purpose now.
2018-01-16 14:14:09 -05:00
Matthias Clasen
3dd3ae1b9d font chooser: Plug a memory leak
We were leaking the hb_font object.
2018-01-04 22:24:21 -05:00
Matthias Clasen
e41e8c4c53 font chooser: Fix a memory leak
We were leaking the delayed font descriptions.
2018-01-04 21:19:28 -05:00
Matthias Clasen
8a5b6d422f fontchooser: fix feature formatting
There was a " missing, causing some features to be missed.
2018-01-04 08:39:18 -05:00
Matthias Clasen
a79f950dfe font chooser: Manage tweak button sensitivity
When we don't have any font features or variation axes,
there is no point in going to the tweak page, so disable
the action in this case.
2018-01-03 14:06:00 -05:00
Matthias Clasen
7687393583 font chooser: Don't set hardcoded default features
We should rely on harfbuzz to select the right defaults.
2018-01-03 13:41:20 -05:00
Matthias Clasen
4cc68a97a8 font chooser: Support font variations
Add sliders for the available axes to the tweak page.
2018-01-03 13:28:33 -05:00
Matthias Clasen
894a0c0ff4 font chooser: Add properties for features and language
These can't be returned as part of the font description,
so we need new api for them. For now, this is just readonly
properties. Maybe these should be writable too, eventually.
2018-01-03 12:18:18 -05:00
Matthias Clasen
ade33c6e14 Add font features on the tweak page 2018-01-03 12:18:18 -05:00
Matthias Clasen
15f8b2d0ae font chooser: Add a tweak page
Add a button the dialog's header bar that lets us
switch to a second page where we can customize
the selected font.

Make the font chooser widget export an action that the
dialog can use for the button. This has some advantages:
- we can export not just the toggle state, but also enabled
- we can reuse the same enabled state to make the select
  button insensitive when no font is selected

To determine whether a font is selected, listen to changes
of the list selection. And ensure that the font chooser is
in an initial state when mapped, even if we close the dialog
from the tweak page.
2018-01-03 12:18:18 -05:00
Matthias Clasen
f0526359d1 font chooser: introduce font chooser levels
This is a more systematic approach to reducing the
level of detail in the font chooser.
2018-01-03 12:18:18 -05:00
Matthias Clasen
78f9193d7e font chooser: Small revision of the UI
Show only the font names in the list, in their own
font, in order to make the list less noisy.
2018-01-03 12:18:18 -05:00
Matthias Clasen
e90787d975 fontchooser: Add global keynav
Starting to type should focus the search entry and start
a search.
2017-12-27 17:29:24 -05:00
Matthias Clasen
5478bd59bf Fix a crash introduced in the previous commit
The signatures of row-inserted and row-deleted are not
identical, so we need to be a bit more careful here.
2017-12-19 14:17:55 -05:00
Matthias Clasen
1b05474979 font chooser: Simplify some code
Instead of separate handlers, just keep a single
handler for both row-inserted and row-deleted.
Slightly less work that way.
2017-12-19 12:10:47 -05:00
Matthias Clasen
e5154547f8 font chooser: Stop listening to style-updated
The only time a style-updated indicates we need
to reload fonts is when it is synthesized by GtkSettings
in response to a fontconfig timestamp change, but
we are listening to those already, anyway.
2017-12-19 11:45:56 -05:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00