1 ###############################################################################
2 # Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the "Software"),
6 # to deal in the Software without restriction, including without limitation
7 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 # and/or sell copies of the Software, and to permit persons to whom the
9 # Software is furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice (including the next
12 # paragraph) shall be included in all copies or substantial portions of the
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 # DEALINGS IN THE SOFTWARE.
24 diff --git a/modules/om/generic/omGeneric.c b/modules/om/generic/omGeneric.c
25 index 64ef7b7..7b40cb1 100644
26 --- a/modules/om/generic/omGeneric.c
27 +++ b/modules/om/generic/omGeneric.c
28 @@ -175,6 +175,11 @@ init_fontset(
29 if((font_set->substitute = init_fontdata(data->substitute,
30 data->substitute_num)) == NULL)
33 + /* Add for load_option */
34 + font_set->delay_loading = data->delay_loading;
35 + font_set->no_checking = data->no_checking;
37 font_set->substitute_num = data->substitute_num;
38 if((font_set->vmap = init_fontdata(data->vmap,
39 data->vmap_num)) == NULL)
40 @@ -283,6 +288,10 @@ load_font(
41 if (font_set->font_name == NULL)
44 + /* no font structure is requeried here. don't load font now. */
45 + if ((font_set->font != NULL) || (font_set->delay_loading))
48 if (load_fontset_data (oc, font_set) != True)
51 @@ -332,12 +341,24 @@ load_font_info(
54 if (font_set->info == NULL) {
55 + /* Handle for delay loading. */
56 + if (font_set->delay_loading)
58 fn_list = XListFontsWithInfo(dpy, font_set->font_name, 1, &fn_num,
60 if (font_set->info == NULL)
65 + font_set->info->fid = XLoadFont(dpy, font_set->font_name);
68 + XFreeFontNames(fn_list);
71 XFreeFontNames(fn_list);
76 @@ -453,7 +474,7 @@ init_core_part(
79 for ( ; font_set_num-- > 0; font_set++) {
80 - if (font_set->font_name == NULL)
81 + if (font_set->font_name == NULL || font_set->delay_loading) /* if delay_loading, continue */
84 length += strlen(font_set->font_name) + 1;
85 @@ -483,7 +504,7 @@ init_core_part(
86 font_set_num = gen->font_set_num;
88 for (count = 0; font_set_num-- > 0; font_set++) {
89 - if (font_set->font_name == NULL)
90 + if (font_set->font_name == NULL || font_set->delay_loading) /* if delay_loading, continue */
94 @@ -1261,7 +1282,7 @@ set_missing_list(
97 for ( ; font_set_num-- > 0; font_set++) {
98 - if (font_set->info || font_set->font) {
99 + if (font_set->info || font_set->font || font_set->no_checking) {
103 @@ -1308,7 +1329,7 @@ set_missing_list(
104 font_set_num = gen->font_set_num;
106 for ( ; font_set_num-- > 0; font_set++) {
107 - if (font_set->info || font_set->font) {
108 + if (font_set->info || font_set->font || font_set->no_checking) {
112 @@ -2092,6 +2113,20 @@ init_om(
114 read_vw(lcd,data,num);
115 length += strlen(data->font_data->name) + 1;
117 + /* For load_option */
118 + data->delay_loading = False;
119 + data->no_checking = False;
120 + snprintf(buf, BUFSIZ, "fs%d.font.load_option", num);
121 + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count);
123 + if (!strcmp(*value, "delay_check")) {
124 + data->delay_loading = True;
125 + } else if (!strcmp(*value, "delay_nocheck")) {
126 + data->delay_loading = True;
127 + data->no_checking = True;
132 /* required charset list */
133 diff --git a/modules/om/generic/omXChar.c b/modules/om/generic/omXChar.c
134 index c9bbb8e..4f80ce0 100644
135 --- a/modules/om/generic/omXChar.c
136 +++ b/modules/om/generic/omXChar.c
137 @@ -285,6 +285,12 @@ load_font(
141 + /* Give up displaying any characters of this missing charset. */
142 + if (font_set->delay_loading == False && font_set->font != NULL) {
146 + /* In case of delay loading, load font here. */
147 font_set->font = XLoadQueryFont(oc->core.om->core.display,
148 oc->core.font_info.font_name_list[font_set->id]);
149 if (font_set->font == NULL)
150 @@ -330,8 +336,10 @@ _XomConvert(
151 if (font_set == NULL)
154 - if (font_set->font == NULL && load_font(oc, font_set) == False)
156 + if (font_set->font == NULL || font_set->delay_loading) {
157 + if (load_font(oc, font_set) == False)
161 length = *to_left - cs_left;
163 diff --git a/src/XomGeneric.h b/src/XomGeneric.h
164 index d6f182d..d8eaf89 100644
165 --- a/src/XomGeneric.h
166 +++ b/src/XomGeneric.h
167 @@ -81,6 +81,9 @@ typedef struct _OMDataRec {
168 XlcCharSet *charset_list;
171 + /* For load_option */
172 + Bool delay_loading;
177 @@ -120,6 +123,9 @@ typedef struct _FontSetRec {
181 + /* For load_option */
182 + Bool delay_loading;