Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
ed148e5c
Commit
ed148e5c
authored
19 years ago
by
rds
Browse files
Options
Downloads
Patches
Plain Diff
conditional is_monospace to compile on gtk < 2.6 e.g. alpha
will now pick the most preferred font from the list (first member)
parent
9b9315a8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/zmapUtils/zmapGUIutils.c
+24
-11
24 additions, 11 deletions
src/zmapUtils/zmapGUIutils.c
with
24 additions
and
11 deletions
src/zmapUtils/zmapGUIutils.c
+
24
−
11
View file @
ed148e5c
...
...
@@ -25,9 +25,9 @@
* Description:
* Exported functions: See ZMap/zmapUtilsGUI.h
* HISTORY:
* Last edited: Mar 21 1
3:38
2006 (
edgrif
)
* Last edited: Mar 21 1
7:16
2006 (
rds
)
* Created: Thu Jul 24 14:37:35 2003 (edgrif)
* CVS info: $Id: zmapGUIutils.c,v 1.1
4
2006-03-21 1
4:07:39 edgrif
Exp $
* CVS info: $Id: zmapGUIutils.c,v 1.1
5
2006-03-21 1
7:17:38 rds
Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -462,12 +462,12 @@ void zMapGUIShowText(char *title, char *text, gboolean edittable)
/* Construct a list of possible fonts to use. */
fixed_font_list
=
g_list_append
(
fixed_font_list
,
"Monospace"
)
;
fixed_font_list
=
g_list_append
(
fixed_font_list
,
"fixed"
)
;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
/* I tried to give several alternative fonts but some of them, e.g. Cursor, do not display
* as monospace even though they apparently are...I don't know why... */
fixed_font_list
=
g_list_append
(
fixed_font_list
,
"fixed"
)
;
fixed_font_list
=
g_list_append
(
fixed_font_list
,
"Serif"
)
;
fixed_font_list
=
g_list_append
(
fixed_font_list
,
"Cursor"
)
;
#endif
/* ED_G_NEVER_INCLUDE_THIS_CODE */
...
...
@@ -626,7 +626,9 @@ char *zmapGUIFileChooser(GtkWidget *toplevel, char *directory)
/*!
* Tries to return a fixed font from the list given in pref_families, returns
* TRUE if it succeeded in finding a matching font, FALSE otherwise.
*
* The list of preferred fonts is treated with most preferred first and least
* preferred last. The function will attempt to return the most preferred font
* it finds.
*
* @param widget Needed to get a context, ideally should be the widget you want to
* either set a font in or find out about a font for.
...
...
@@ -641,10 +643,10 @@ gboolean zMapGUIGetFixedWidthFont(GtkWidget *widget,
GList
*
pref_families
,
gint
points
,
PangoWeight
weight
,
PangoFont
**
font_out
,
PangoFontDescription
**
desc_out
)
{
gboolean
found
=
FALSE
;
gboolean
found
=
FALSE
,
found_most_preferred
=
FALSE
;
PangoContext
*
context
;
PangoFontFamily
**
families
;
gint
n_families
,
i
;
gint
n_families
,
i
,
most_preferred
,
current
;
PangoFontFamily
*
match_family
=
NULL
;
PangoFont
*
font
=
NULL
;
...
...
@@ -652,27 +654,38 @@ gboolean zMapGUIGetFixedWidthFont(GtkWidget *widget,
pango_context_list_families
(
context
,
&
families
,
&
n_families
)
;
for
(
i
=
0
;
(
i
<
n_families
&&
!
found
)
;
i
++
)
most_preferred
=
g_list_length
(
pref_families
);
for
(
i
=
0
;
(
i
<
n_families
&&
!
found_most_preferred
)
;
i
++
)
{
const
gchar
*
name
;
GList
*
pref
;
name
=
pango_font_family_get_name
(
families
[
i
])
;
current
=
0
;
pref
=
g_list_first
(
pref_families
)
;
while
(
pref
)
while
(
pref
&&
++
current
)
{
char
*
pref_font
=
(
char
*
)
pref
->
data
;
if
(
g_ascii_strncasecmp
(
name
,
pref_font
,
strlen
(
pref_font
))
==
0
#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6
&&
pango_font_family_is_monospace
(
families
[
i
])
#endif
)
{
found
=
TRUE
;
match_family
=
families
[
i
]
;
if
(
current
<=
most_preferred
)
{
if
((
most_preferred
=
current
)
==
1
)
found_most_preferred
=
TRUE
;
match_family
=
families
[
i
]
;
}
match_family
=
families
[
i
]
;
break
;
}
pref
=
g_list_next
(
pref
)
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment