atspi: Add pango utilities

This code is more or less a direct copy of what
we had in gtkpango.c in 3.x.
This commit is contained in:
Matthias Clasen 2020-10-10 13:42:07 -04:00
parent ddb72accc0
commit 7c8a16812e
4 changed files with 1311 additions and 0 deletions

1238
gtk/a11y/gtkatspipango.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
/* gtkatspipangoprivate.h: Utilities for pango and AT-SPI
* Copyright 2020 Red Hat, Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <pango/pangocairo.h>
#include "gtkatspiprivate.h"
G_BEGIN_DECLS
void gtk_pango_get_default_attributes (PangoLayout *layout,
GVariantBuilder *builder);
void gtk_pango_get_run_attributes (PangoLayout *layout,
GVariantBuilder *builder,
int offset,
int *start_offset,
int *end_offset);
char *gtk_pango_get_text_before (PangoLayout *layout,
int offset,
AtspiTextBoundaryType boundary_type,
int *start_offset,
int *end_offset);
char *gtk_pango_get_text_at (PangoLayout *layout,
int offset,
AtspiTextBoundaryType boundary_type,
int *start_offset,
int *end_offset);
char *gtk_pango_get_text_after (PangoLayout *layout,
int offset,
AtspiTextBoundaryType boundary_type,
int *start_offset,
int *end_offset);
char *gtk_pango_get_string_at (PangoLayout *layout,
int offset,
AtspiTextGranularity granularity,
int *start_offset,
int *end_offset);
G_END_DECLS

View File

@ -228,4 +228,22 @@ typedef enum {
ATSPI_RELATION_LAST_DEFINED,
} AtspiRelationType;
typedef enum {
ATSPI_TEXT_BOUNDARY_CHAR,
ATSPI_TEXT_BOUNDARY_WORD_START,
ATSPI_TEXT_BOUNDARY_WORD_END,
ATSPI_TEXT_BOUNDARY_SENTENCE_START,
ATSPI_TEXT_BOUNDARY_SENTENCE_END,
ATSPI_TEXT_BOUNDARY_LINE_START,
ATSPI_TEXT_BOUNDARY_LINE_END,
} AtspiTextBoundaryType;
typedef enum {
ATSPI_TEXT_GRANULARITY_CHAR,
ATSPI_TEXT_GRANULARITY_WORD,
ATSPI_TEXT_GRANULARITY_SENTENCE,
ATSPI_TEXT_GRANULARITY_LINE,
ATSPI_TEXT_GRANULARITY_PARAGRAPH
} AtspiTextGranularity;
G_END_DECLS

View File

@ -13,5 +13,6 @@ if gtk_a11y_backends.contains('atspi')
'gtkatspicontext.c',
'gtkatspiroot.c',
'gtkatspiutils.c',
'gtkatspipango.c',
])
endif