[gui][PATCH] Account for font style and default language in font metric calculations

Thomas Fitzsimmons fitzsim@redhat.com
Tue Jun 15 03:03:00 GMT 2004


Hi,

This patch fixes two problems with font metric calculations in the GTK
peers.  First, the AWT font style (plain, bold, italic) wasn't being
taken into account.  Second, NULL was being passed as the language
parameter to pango_context_get_metrics.  This produces metrics that
don't correspond with the font that is currently in use.  This patch
fixes the problem by passing the current language (the return value of
gtk_get_default_language ()) when retrieving font metrics.

I committed this patch to java-gui-branch.

Tom

2004-06-14  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/awt/peer/gtk/GdkFontMetrics.java (initState): Add
	style parameter.
	(GdkFontMetrics): Add style argument to initState call.
	(stringWidth(String,int,int,String)): Add style parameter.
	(stringWidth(String)): Add style argument to stringWidth call.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
	(initState): Set pango font style and weight based on AWT style
	parameter.  Pass default GTK language to
	pango_context_get_metrics.  Use PANGO_PIXELS macro rather than
	simply dividing by PANGO_SCALE.
	(stringWidth): Set pango font style and weight based on AWT style
	parameter.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fontmetrics-default-language.patch
Type: text/x-patch
Size: 4399 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20040615/1c4fa070/attachment.bin>


More information about the Java-patches mailing list