###############################################################################
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use subject to license terms.
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute,
and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, provided that the above
# copyright notice(s) and this permission notice appear in all copies of
# the Software and that both the above copyright notice(s) and this
# permission notice appear in supporting documentation.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# Except as contained in this notice, the name of a copyright holder
# shall not be used in advertising or otherwise to promote the sale, use
# or other dealings in this Software without prior written authorization
# of the copyright holder.
@@ -177,6 +177,11 @@ init_fontset(
if((font_set->substitute = init_fontdata(data->substitute,
data->substitute_num)) == NULL)
+ /*Add for load_option*/
+ font_set->delay_loading = data->delay_loading;
+ font_set->no_checking = data->no_checking;
font_set->substitute_num = data->substitute_num;
if((font_set->vmap = init_fontdata(data->vmap,
data->vmap_num)) == NULL)
@@ -285,33 +290,41 @@ load_font(
if (font_set->font_name == NULL)
- if (load_fontset_data (oc, font_set) != True)
+ /* no font structure is requeried here. don't load font now. */
+ if (font_set->font == NULL) {
+ if (font_set->delay_loading) {
+ if (load_fontset_data (oc, font_set) != True)
- if(load_fontdata(oc, font_set->font_data,
- font_set->font_data_count) != True)
+ if(load_fontdata(oc, font_set->font_data,
+ font_set->font_data_count) != True)
- if(load_fontdata(oc, font_set->substitute,
- font_set->substitute_num) != True)
+ if(load_fontdata(oc, font_set->substitute,
+ font_set->substitute_num) != True)
- if (font_set->vpart_initialize == 0) {
- load_fontdata(oc, font_set->vmap, font_set->vmap_num);
- load_fontdata(oc, (FontData) font_set->vrotate,
- font_set->vrotate_num);
- font_set->vpart_initialize = 1;
+ if (font_set->vpart_initialize == 0) {
+ load_fontdata(oc, font_set->vmap, font_set->vmap_num);
+ load_fontdata(oc, (FontData) font_set->vrotate,
+ font_set->vrotate_num);
+ font_set->vpart_initialize = 1;
- if (font_set->font->min_byte1 || font_set->font->max_byte1)
- font_set->is_xchar2b = True;
- font_set->is_xchar2b = False;
+ if (font_set->font->min_byte1 || font_set->font->max_byte1)
+ font_set->is_xchar2b = True;
+ font_set->is_xchar2b = False;
@@ -334,12 +347,24 @@ load_font_info(
if (font_set->info == NULL) {
+ /*Handle for delay loading.*/
+ if (font_set->delay_loading)
fn_list = XListFontsWithInfo(dpy, font_set->font_name, 1, &fn_num,
if (font_set->info == NULL)
+ font_set->info->fid = XLoadFont(dpy, font_set->font_name);
+ XFreeFontNames(fn_list);
@@ -456,7 +481,7 @@ init_core_part(
for ( ; font_set_num-- > 0; font_set++) {
- if (font_set->font_name == NULL)
+ if (font_set->font_name == NULL || font_set->delay_loading)/*if delay_loading, continue*/
length += strlen(font_set->font_name) + 1;
@@ -486,7 +511,7 @@ init_core_part(
font_set_num = gen->font_set_num;
for (count = 0; font_set_num-- > 0; font_set++) {
- if (font_set->font_name == NULL)
+ if (font_set->font_name == NULL || font_set->delay_loading) /*if delay_loading, continue*/
@@ -1177,7 +1202,7 @@ parse_fontname(
* a "missing_charset" will be reported to the client
- font_data_return. xlfd_name = NULL;
ret = parse_fontdata(oc, font_set, font_set->font_data,
@@ -1275,7 +1300,7 @@ set_missing_list(
for ( ; font_set_num-- > 0; font_set++) {
- if (font_set->info || font_set->font) {
+ if (font_set->info || font_set->font || font_set->no_checking) {
@@ -1322,7 +1347,7 @@ set_missing_list(
font_set_num = gen->font_set_num;
for ( ; font_set_num-- > 0; font_set++) {
- if (font_set->info || font_set->font) {
+ if (font_set->info || font_set->font || font_set->no_checking) {
@@ -2110,6 +2135,20 @@ init_om(
length += strlen(data->font_data->name) + 1;
+ data->delay_loading = False;
+ data->no_checking = False;
+ _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count);
+ if (!strcmp(*value, "delay_check")) {
+ data->delay_loading = True;
+ } else if (!strcmp(*value, "delay_nocheck")) {
+ data->delay_loading = True;
+ data->no_checking = True;
/* required charset list */
@@ -328,6 +328,12 @@ load_font(
+ /* Give up displaying any characters of this missing charset. */
+ if (font_set->delay_loading == False && font_set->font!=NULL) {
+ /*In case of delay loading, load font here.*/
if (font_set->font == NULL)
@@ -377,8 +383,10 @@ _XomConvert(
- if (font_set->font == NULL && load_font(oc, font_set) == False)
+ if (font_set->font == NULL||font_set->delay_loading){
+ if (load_font(oc, font_set) == False)
length = *to_left - cs_left;
@@ -83,6 +83,9 @@ typedef struct _OMDataRec {
XlcCharSet *charset_list;
@@ -122,6 +125,9 @@ typedef struct _FontSetRec {