Commit Graph

210 Commits

Author SHA1 Message Date
Matthias Clasen
9948053cd7 Deprecate GtkDialog
GtkDialog is too flexible in terms of UI (headerbars vs action bar,
etc), and has archaic APIs. It is time to retire it.
2022-10-29 15:27:53 -04:00
Matthias Clasen
15572b0183 Deprecate GtkFontChooser and implementations
These are being replaced by GtkFontDialog
and GtkFontDialogButton

This commit only moves the headers for GtkFontChooserWidget and
GtkFontChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFontChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
bd5dedce12 fontchooser: Add a way to set a GtkFilter
We keep this private, since the chooser apis
are going away. This will be used in GtkFontDialog.
2022-10-29 10:18:37 -04:00
Matthias Clasen
3723778f42 fontchooser: Stop using deprecated harfbuzz api
The replacement is very straightforward.
2022-10-21 21:54:38 -04:00
Matthias Clasen
e499a09759 Drop gtkintl.h
Include gtkprivate.h for I_() and glib-i18n.h for
gettext macros.
2022-09-24 10:03:37 -04:00
Matthias Clasen
39439aa838 fontchooser: Rename default feature value
"Default" is a better fit than "None" here.
2022-08-29 14:14:07 -04:00
Matthias Clasen
c364f1ee12 fontchooser: Improve handling of features
salt and swsh need to be treated like cvXX, with
a dropdown. Also add examples to the default cases
of radio groups.
2022-08-28 17:02:56 -04:00
Matthias Clasen
0441fd3678 fontchooser: Handle font features better
Properly show multiple-choice cvXX features as dropdowns,
include afrc, and fix bugs in feature enumeration that
made some features not show up.
2022-08-26 17:53:55 -04:00
Matthias Clasen
ab1cf67432 fontchooser: Make size level effective
We were not hiding the size controls on the tweaks
page, which is arguably what should happen when
the size level is disabled.
2022-07-03 12:50:40 -04:00
Matthias Clasen
d0894b2786 fontchooser: Some OpenType improvements
Work harder to find examples for char variation
features, and pull the feature labels out of
the font if possible. This lets us show
meaningful names like "Localised @ and & symbols"
instead of "Stylistic Set 7" or even "ss07".
2022-07-03 07:38:24 -04:00
Sophie Herold
a546ae32d7 Remove all nicks and blurbs from param specs
Those property features don't seem to be in use anywhere.
They are redundant since the docs cover the same information
and more. They also created unnecessary translation work.

Closes #4904
2022-05-11 18:16:29 +02:00
Matthias Clasen
70732afb95 Drop the script name data
It is not used in GTK itself, and gtk4-demo
has its own copy.
2022-01-10 10:43:05 -05:00
Matthias Clasen
dd802f21e7 fontchooser: Cosmetics
Use harfbuzz api to format variations and features.
That matches what pango uses to parse them.
2022-01-02 21:37:32 -05:00
Matthias Clasen
dbbc990c72 fontchooser: Use new hb api
Use hb_font_get_var_coords_design if we have it.
This should fix our handling of fonts with AVAR.
2022-01-02 21:37:32 -05:00
Matthias Clasen
791dc7b9be fontchooser: Speed up fature examples
We were doing unnecessary work here, which could
get really slow with some fonts. Just compute
the reverse charmap once and reuse it.
2022-01-01 15:38:04 -05:00
Matthias Clasen
ff24dfb2e7 Revert "fontchooserwidget: Revise handling of named instances"
This reverts commit 2dc56a6e9b.

This wasn't ready yet.
2022-01-01 15:36:29 -05:00
Matthias Clasen
4db60fa5a8 Revert "fontchoserwidget: Do our own face filtering"
This reverts commit b7b6c147f9.

This was premature.
2022-01-01 15:36:27 -05:00
Matthias Clasen
b7b6c147f9 fontchoserwidget: Do our own face filtering
Pango may not do this for us, so don't rely on it.
We only show one face with a given name, and we
prefer a variable face over a non-variable one.

The check for variable faces requires new Pango
API that will be in Pango 1.52.
2021-12-31 09:58:26 -05:00
Matthias Clasen
2dc56a6e9b fontchooserwidget: Revise handling of named instances
Allowing to tweak the axes of named instances does
not do any harm. If we don't, we have to worry that
we need at least one non-named-instance in the face
list, and make it more obvious how to pick it out.
2021-12-31 09:50:47 -05:00
Matthias Clasen
e12ef76de5 fontchooserwidget: Avoid a crash
languages may be NULL, we need to be more careful here.
2021-12-31 09:49:40 -05:00
Matthias Clasen
80328e8a4f fontchooser: Stop using pangofc api
Pango now has backend-independent api for all
we need, so we can drop all the ifdefs.
2021-12-30 22:52:52 -05:00
Matthias Clasen
e9d8bf96e0 fontchooser: Avoid setting variations needlessly
Setting variations to their default value causes
them to show up in the serialization of the font
description - a font description has no idea about
the default values, so can't filter them out.

Avoid that.
2021-11-27 17:13:23 -05:00
Matthias Clasen
1e22572716 Avoid pango deprecations
This function has been deprecated on the main
branch of pango. Since we don't want to bump our
pango dependency to 1.49 yet, ignore the deprecation.
2021-08-01 23:20:01 -04:00
Matthias Clasen
8caadaf404 fontchooser: Fix initial font selection
The change in 740559a54f to populate the list incrementally
broke initial font selection. Fix that, by trying to select
until the incremental filling is done.

Fixes: #3687
2021-04-02 01:06:23 -04:00
Matthias Clasen
bb393f6496 fontchooserwidget: Convert docs 2021-03-11 16:37:33 +00:00
Matthias Clasen
10d5705b70 Reduce use of GtkStyleContext
Remove some unnecessary uses of GtkStyleContext where
we can directly go to the GtkCssStyle, and and drop
unnnecessary includes.
2021-01-28 12:27:07 -05:00
Matthias Clasen
6cbd7e29dd fontchooser: Plug listmodel memory leaks
We were leaking references returned from g_list_model_get_item
in some places.
2020-11-10 09:07:40 -05:00
Matthias Clasen
752270253f fontchooser: Fix builds without PangoFT2
Currently, only if PangoFT2 is present and used it is supported
to retrieve the languages that are supported by a particular font.

If we don't have PangoFT2, remove the language filtering and the
sample text selection.

Based on earlier work by Chun-wei Fan, see
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2614
2020-09-26 19:15:45 -04:00
Matthias Clasen
3c62cd90d4 fontchooser: Handle families without faces
This might seem useless, but I've met fonts
where pango_font_family_get_face (family, NULL)
return NULL. Handle it without criticals.
2020-09-20 10:59:37 -04:00
Matthias Clasen
4e35d56263 fontchooser: Remove signal handlers in dispose
Avoid ordering issues in dispose by disconnecting
the rows_changed_cb handler first thing.
2020-09-19 10:44:50 -04:00
Matthias Clasen
a9bf129286 fontchooser: Don't show "No fonts" prematurely
Don't switch to the empty page while we are still busy
filtering. Fonts might yet appear.
2020-09-19 10:25:45 -04:00
Matthias Clasen
76b7f0ca1c fontchooser: Use filter language for sample text
When you are asking to only see fonts that support
a given language, you probably want to see the
sample text for that language too.
2020-09-19 10:13:36 -04:00
Matthias Clasen
09604eb3eb fontchooser: Add user filtering
Add a popover that has filtering options. As a start,
allow filtering by monospace and by language coverage.
2020-09-19 10:13:36 -04:00
Matthias Clasen
69d5dc7c9a fontchooser: Determine sample text intelligently
Look at the languages supported by a font, and pick
a suitable sample text from the pango list of sample
texts. We can only implement this on platforms using
fontconfig, since it relies on pangofc apis.

This bumps the pango dependency to 1.47.1.
2020-09-18 23:04:39 -04:00
Matthias Clasen
af155838bd fontchooser: Fix radio groups for features
We need to use grouped checkbuttons now.
2020-08-30 17:59:23 -04:00
Timm Bäder
1375fb4464 Change button hierarchy
A radiobutton without indicator is really just a togglebutton with a
group.

A radiobutton with indicator is really just a checkbutton with a group.

Make checkbutton its own widget not inheriting from GtkButton.
GtkRadioButton could be removed but it stays for now.

Radiobutton && !draw-indicator => Togglebutton
Checkbutton && !draw-indicator => Togglebutton

Radiobutton && draw-indicator => CheckButton + group
2020-08-29 16:46:28 +02:00
Matthias Clasen
740559a54f fontchooser: Populate the list incrementally
By adding 20 fonts / frame to the font list, we can
get the font chooser dialog to show up much faster.

This change gets the font chooser up in 265ms here.
2020-08-25 15:51:04 -04:00
Matthias Clasen
54e4bf8b75 Fix a leak in the font chooser widget
Contrary to what you may expect, pango_attr_font_desc_new()
is not transfer full, it makes a copy of the font description.
2020-08-23 16:45:15 -04:00
Matthias Clasen
bc0182fa3e Merge branch 'ebassi/new-a11y' into 'master'
Accessibility rework

See merge request GNOME/gtk!2239
2020-07-27 11:55:19 +00:00
Matthias Clasen
1e8be87026 flattenlistmodel: Make the constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 18:02:44 -04:00
Emmanuele Bassi
c63087a563 Remove ATK
To build a better world sometimes means having to tear the old one down.
        -- Alexander Pierce, "Captain America: The Winter Soldier"

ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:

 - it maps to a very specific implementation, AT-SPI, which is Linux and
   Unix specific
 - it requires implementing the same functionality in three different
   layers of the stack: AT-SPI, ATK, and GTK
 - only GTK uses it; every other Linux and Unix toolkit and application
   talks to AT-SPI directly, including assistive technologies

Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:

 - add an "accessible" interface, implemented by GTK objects directly,
   which describe the accessible role and state changes for every UI
   element
 - add an "assistive technology context" to proxy a native accessibility
   API, and assign it to every widget
 - implement the AT context depending on the platform

For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
2020-07-26 20:31:14 +01:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Benjamin Otte
5080730728 listmodels: Stop respecting item-type
Simplify all view model APIs and always return G_TYPE_OBJECT as the
item-type for every model.

It turns out nobody uses item-type anyway.

So instead of adding lots of APIs, forcing people to think about it and
trying to figure out how to handle filter or map models that modify item
types, just having an easy life is a better approach.

All the models need to be able to deal with any type of object going
through anyway.
2020-07-05 02:59:21 +02:00
Matthias Clasen
2a9c92f8e2 Drop unused includes
This is just cleanup to help tracking down
remaining GtkComboBox uses.
2020-06-16 14:34:54 -04:00
Matthias Clasen
c8843d0730 fontchooser: Drop unused includes 2020-06-15 23:10:40 -04:00
Benjamin Otte
58b65d1bf6 fontchooserwidget: Port to listmodels
The port is kind of evil, in that it stores either a PangoFontFamily or a
PangoFontFace in the list, depending on if the fontchooser is configured
to select fonts or faces.
It also does not cache the font description anymore, so more calls to
pango_font_describe() may happen.

If both of these issues turn out problematic, the fontchooser would need
to resurrect GtkDelayedFontDescription again and put objects of that
type through the model.

These changes depend on Pango 1.46's introduction of listmodels and
various new getters, so the dependency has been upgraded.
2020-05-30 19:26:46 -04:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Matthias Clasen
2a24b8c653 Replace most remaining uses of container api
These are all on GtkBox or enumerating children.
2020-05-11 22:38:21 -04:00