Add missing gdk_rectangle_get_type() prototype.

Mon Jun 11 18:15:16 2001  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdk.h: Add missing gdk_rectangle_get_type() prototype.

	* gtk/gtk[hv]scale.c: Include math.h, stdlib.h

	* gdk/gdkpango.h gtk/gtkclist.c gtk/gtkentry.c gtk/gtkmain.[ch]
	  gtk/gtkspinbutton.c gtk/gtkstyle.c gtk/gtktextbuffer.c
	  gtk/gtktextdisplay.c gtk/gtktextiter.[ch]
	  gtk/gtktextlayout.c gtk/gtktexttag.[ch] gtk/gtkwidget.c: Adapt
	  to recent changes in Pango.

	* tests/testgtk.c: Set language tags with gtk_label_set_markup()
	  to test whether the basic engine honors them.
This commit is contained in:
Owen Taylor 2001-06-14 20:41:44 +00:00 committed by Owen Taylor
parent 7d1a049bc3
commit 22491fd6a4
19 changed files with 69 additions and 64 deletions

View File

@ -126,6 +126,8 @@ void gdk_rectangle_union (GdkRectangle *src1,
GdkRectangle *src2,
GdkRectangle *dest);
GType gdk_rectangle_get_type (void);
#define GDK_TYPE_RECTANGLE (gdk_rectangle_get_type ())
/* Conversion functions between wide char and multibyte strings.

View File

@ -452,7 +452,7 @@ gdk_pango_get_item_properties (PangoItem *item,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect)
{
GSList *tmp_list = item->extra_attrs;
GSList *tmp_list = item->analysis.extra_attrs;
if (strikethrough)
*strikethrough = FALSE;

View File

@ -3027,11 +3027,11 @@ gtk_clist_set_row_height (GtkCList *clist,
PangoContext *context = gtk_widget_get_pango_context (widget);
PangoFontMetrics metrics;
PangoFont *font = pango_context_load_font (context, widget->style->font_desc);
gchar *lang = pango_context_get_lang (context);
pango_font_get_metrics (font, lang, &metrics);
pango_font_get_metrics (font,
pango_context_get_language (context),
&metrics);
g_free (lang);
g_object_unref (G_OBJECT (font));
if (!GTK_CLIST_ROW_HEIGHT_SET(clist))

View File

@ -1036,8 +1036,8 @@ gtk_entry_size_request (GtkWidget *widget,
GtkEntry *entry;
PangoFontMetrics metrics;
PangoFont *font;
gchar *lang;
gint xborder, yborder;
PangoContext *context;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_ENTRY (widget));
@ -1047,11 +1047,11 @@ gtk_entry_size_request (GtkWidget *widget,
/* hackish for now, get metrics
*/
font = pango_context_load_font (gtk_widget_get_pango_context (widget),
widget->style->font_desc);
lang = pango_context_get_lang (gtk_widget_get_pango_context (widget));
pango_font_get_metrics (font, lang, &metrics);
g_free (lang);
context = gtk_widget_get_pango_context (widget);
font = pango_context_load_font (context, widget->style->font_desc);
pango_font_get_metrics (font,
pango_context_get_language (context),
&metrics);
g_object_unref (G_OBJECT (font));

View File

@ -24,7 +24,9 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "gtkhscale.h"
#include "gtksignal.h"
#include "gtkintl.h"

View File

@ -598,10 +598,11 @@ gtk_set_locale (void)
*
* Return value: the default language as an allocated string, must be freed
**/
gchar*
PangoLanguage *
gtk_get_default_language (void)
{
gchar *lang;
PangoLanguage *result;
gchar *p;
lang = g_strdup (setlocale (LC_CTYPE, NULL));
@ -612,6 +613,9 @@ gtk_get_default_language (void)
if (p)
*p = '\0';
result = pango_language_from_string (lang);
g_free (lang);
return lang;
}

View File

@ -106,11 +106,9 @@ gboolean gtk_init_check_abi_check (int *argc,
#ifndef GTK_DISABLE_DEPRECATED
void gtk_exit (gint error_code);
#endif /* GTK_DISABLE_DEPRECATED */
gchar* gtk_set_locale (void);
gchar* gtk_get_default_language (void);
gint gtk_events_pending (void);
gchar * gtk_set_locale (void);
PangoLanguage *gtk_get_default_language (void);
gint gtk_events_pending (void);
/* The following is the event func GTK+ registers with GDK
* we expose it mainly to allow filtering of events between

View File

@ -567,19 +567,19 @@ gtk_spin_button_size_request (GtkWidget *widget,
if (entry->width_chars < 0)
{
PangoContext *context;
PangoFontMetrics metrics;
PangoFont *font;
gchar *lang;
gint width;
gint w;
int string_len;
font = pango_context_load_font (gtk_widget_get_pango_context (widget),
context = gtk_widget_get_pango_context (widget);
font = pango_context_load_font (context,
widget->style->font_desc);
lang = pango_context_get_lang (gtk_widget_get_pango_context (widget));
pango_font_get_metrics (font, lang, &metrics);
g_free (lang);
pango_font_get_metrics (font,
pango_context_get_language (context),
&metrics);
g_object_unref (G_OBJECT (font));
/* Get max of MIN_SPIN_BUTTON_WIDTH, size of upper, size of lower */

View File

@ -4076,7 +4076,7 @@ get_insensitive_layout (PangoLayout *layout)
if (run)
{
tmp_list = run->item->extra_attrs;
tmp_list = run->item->analysis.extra_attrs;
while (tmp_list != NULL)
{

View File

@ -3248,7 +3248,6 @@ compute_log_attrs (const GtkTextIter *iter,
gchar *paragraph;
gint char_len, byte_len;
PangoLogAttr *attrs = NULL;
gchar *lang;
start = *iter;
end = *iter;
@ -3267,14 +3266,10 @@ compute_log_attrs (const GtkTextIter *iter,
attrs = g_new (PangoLogAttr, char_len);
lang = gtk_text_iter_get_language (&start);
pango_get_log_attrs (paragraph, byte_len, -1,
lang,
gtk_text_iter_get_language (&start),
attrs);
g_free (lang);
g_free (paragraph);
return attrs;

View File

@ -191,7 +191,7 @@ get_shape_extents (PangoLayoutRun *run,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect)
{
GSList *tmp_list = run->item->extra_attrs;
GSList *tmp_list = run->item->analysis.extra_attrs;
while (tmp_list)
{
@ -653,7 +653,7 @@ static void
get_item_properties (PangoItem *item,
GtkTextAppearance **appearance)
{
GSList *tmp_list = item->extra_attrs;
GSList *tmp_list = item->analysis.extra_attrs;
*appearance = NULL;

View File

@ -1379,17 +1379,17 @@ gtk_text_iter_editable (const GtkTextIter *iter,
*
* Return value: language in effect at @iter
**/
gchar*
PangoLanguage *
gtk_text_iter_get_language (const GtkTextIter *iter)
{
GtkTextAttributes *values;
gchar *retval;
PangoLanguage *retval;
values = gtk_text_attributes_new ();
gtk_text_iter_get_attributes (iter, values);
retval = g_strdup (values->language);
retval = values->language;
gtk_text_attributes_unref (values);

View File

@ -142,11 +142,11 @@ gboolean gtk_text_iter_is_cursor_position (const GtkTextIter *iter);
gint gtk_text_iter_get_chars_in_line (const GtkTextIter *iter);
gint gtk_text_iter_get_bytes_in_line (const GtkTextIter *iter);
gboolean gtk_text_iter_get_attributes (const GtkTextIter *iter,
GtkTextAttributes *values);
gchar* gtk_text_iter_get_language (const GtkTextIter *iter);
gboolean gtk_text_iter_is_end (const GtkTextIter *iter);
gboolean gtk_text_iter_is_start (const GtkTextIter *iter);
gboolean gtk_text_iter_get_attributes (const GtkTextIter *iter,
GtkTextAttributes *values);
PangoLanguage* gtk_text_iter_get_language (const GtkTextIter *iter);
gboolean gtk_text_iter_is_end (const GtkTextIter *iter);
gboolean gtk_text_iter_is_start (const GtkTextIter *iter);
/*
* Moving around the buffer

View File

@ -1492,7 +1492,7 @@ add_cursor (GtkTextLayout *layout,
static gboolean
is_shape (PangoLayoutRun *run)
{
GSList *tmp_list = run->item->extra_attrs;
GSList *tmp_list = run->item->analysis.extra_attrs;
while (tmp_list)
{
@ -1582,6 +1582,7 @@ add_preedit_attrs (GtkTextLayout *layout,
PangoAttribute *insert_attr;
GSList *extra_attrs = NULL;
GSList *tmp_list;
PangoLanguage *language;
gint start, end;
pango_attr_iterator_range (iter, &start, &end);
@ -1590,7 +1591,7 @@ add_preedit_attrs (GtkTextLayout *layout,
end = layout->preedit_len;
pango_attr_iterator_get_font (iter, &style->font,
&font_desc, &extra_attrs);
&font_desc, &language, &extra_attrs);
tmp_list = extra_attrs;
while (tmp_list)
@ -1631,6 +1632,15 @@ add_preedit_attrs (GtkTextLayout *layout,
pango_attr_list_insert (attrs, insert_attr);
if (language)
{
insert_attr = pango_attr_language_new (language);
insert_attr->start_index = start + offset;
insert_attr->end_index = end + offset;
pango_attr_list_insert (attrs, insert_attr);
}
add_generic_attrs (layout, &appearance, end - start,
attrs, start + offset,
size_only, TRUE);

View File

@ -1088,7 +1088,7 @@ gtk_text_tag_set_property (GObject *object,
case PROP_LANGUAGE:
text_tag->language_set = TRUE;
text_tag->values->language = g_strdup (g_value_get_string (value));
text_tag->values->language = pango_language_from_string (g_value_get_string (value));
g_object_notify (G_OBJECT (text_tag), "language_set");
break;
@ -1425,7 +1425,7 @@ gtk_text_tag_get_property (GObject *object,
break;
case PROP_LANGUAGE:
g_value_set_string (value, tag->values->language);
g_value_set_string (value, pango_language_to_string (tag->values->language));
break;
case PROP_TABS:
@ -1818,9 +1818,6 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src,
if (dest->appearance.fg_stipple)
gdk_bitmap_unref (dest->appearance.fg_stipple);
if (dest->language)
g_free (dest->language);
if (dest->font.family_name)
g_free (dest->font.family_name);
@ -1832,7 +1829,7 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src,
if (src->tabs)
dest->tabs = pango_tab_array_copy (src->tabs);
dest->language = g_strdup (src->language);
dest->language = src->language;
dest->font.family_name = g_strdup (src->font.family_name);
@ -1882,9 +1879,6 @@ gtk_text_attributes_unref (GtkTextAttributes *values)
if (values->tabs)
pango_tab_array_free (values->tabs);
if (values->language)
g_free (values->language);
if (values->font.family_name)
g_free (values->font.family_name);
@ -2059,10 +2053,7 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
dest->bg_full_height = vals->bg_full_height;
if (tag->language_set)
{
g_free (dest->language);
dest->language = g_strdup (vals->language);
}
dest->language = vals->language;
++n;
}

View File

@ -170,7 +170,7 @@ struct _GtkTextAttributes
* GTK_WRAPMODE_NONE, GTK_WRAPMODE_WORD
*/
gchar *language;
PangoLanguage *language;
/* hide the text */
guint invisible : 1;

View File

@ -24,7 +24,9 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "gtkvscale.h"
#include "gtksignal.h"
#include "gtkintl.h"

View File

@ -3989,7 +3989,6 @@ PangoContext *
gtk_widget_create_pango_context (GtkWidget *widget)
{
PangoContext *context;
char *lang;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
@ -4000,10 +3999,7 @@ gtk_widget_create_pango_context (GtkWidget *widget)
gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
pango_context_set_font_description (context, widget->style->font_desc);
lang = gtk_get_default_language ();
pango_context_set_lang (context, lang);
g_free (lang);
pango_context_set_language (context, gtk_get_default_language ());
return context;
}

View File

@ -2105,9 +2105,14 @@ void create_labels (void)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Internationalized Label");
label = gtk_label_new ("French (Français) Bonjour, Salut\n"
"Korean (한글) 안녕하세요, 안녕하십니까\n"
"Russian (Русский) Здравствуйте!");
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"French (Français) Bonjour, Salut\n"
"Korean (한글) 안녕하세요, 안녕하십니까\n"
"Russian (Русский) Здравствуйте!\n"
"Chinese (Simplified) <span lang=\"zh-cn\">元气 开发</span>\n"
"Chinese (Traditional) <span lang=\"zh-tw\">元氣 開發</span>\n"
"Japanese <span lang=\"ja\">元気 開発</span>");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);