mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
DtHelp: Apply graceful degradation for font loading to avoid a segmentation
fault.
This commit is contained in:
parent
6f952545fb
commit
a9ceb6db7a
4 changed files with 36 additions and 2 deletions
|
@ -78,6 +78,7 @@ extern "C" {
|
||||||
* Semi Public Routines
|
* Semi Public Routines
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
extern void _DtHelpCopyDefaultList(XrmName *xrm_list);
|
extern void _DtHelpCopyDefaultList(XrmName *xrm_list);
|
||||||
|
extern void _DtHelpCopyCasualList(XrmName *xrm_list);
|
||||||
extern long __DtHelpDefaultFontIndexGet (
|
extern long __DtHelpDefaultFontIndexGet (
|
||||||
DtHelpDispAreaStruct *pDAS);
|
DtHelpDispAreaStruct *pDAS);
|
||||||
extern void _DtHelpGetStringQuarks(XrmName *xrm_list);
|
extern void _DtHelpGetStringQuarks(XrmName *xrm_list);
|
||||||
|
|
|
@ -266,6 +266,7 @@ static const char *FontResources[] =
|
||||||
static Boolean QuarksInited = FALSE;
|
static Boolean QuarksInited = FALSE;
|
||||||
static XrmQuark StringFontQuark = 0;
|
static XrmQuark StringFontQuark = 0;
|
||||||
static XrmName DefaultFontQuarks[_DtHelpFontQuarkNumber];
|
static XrmName DefaultFontQuarks[_DtHelpFontQuarkNumber];
|
||||||
|
static XrmName CasualFontQuarks[_DtHelpFontQuarkNumber];
|
||||||
static XrmBinding FontBindings[_DtHelpFontQuarkNumber] =
|
static XrmBinding FontBindings[_DtHelpFontQuarkNumber] =
|
||||||
{ XrmBindLoosely, XrmBindLoosely, XrmBindLoosely, XrmBindLoosely,
|
{ XrmBindLoosely, XrmBindLoosely, XrmBindLoosely, XrmBindLoosely,
|
||||||
XrmBindLoosely, XrmBindLoosely, XrmBindLoosely };
|
XrmBindLoosely, XrmBindLoosely, XrmBindLoosely };
|
||||||
|
@ -673,6 +674,25 @@ _DtHelpCopyDefaultList (
|
||||||
xrm_list[n] = DefaultFontQuarks[n];
|
xrm_list[n] = DefaultFontQuarks[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Function: void _DtHelpCopyCasualList (xrm_name)
|
||||||
|
*
|
||||||
|
* Parameters: xrm_name The quark list to fill out.
|
||||||
|
*
|
||||||
|
* Return Value: void
|
||||||
|
*
|
||||||
|
* Purpose:
|
||||||
|
*****************************************************************************/
|
||||||
|
void
|
||||||
|
_DtHelpCopyCasualList (
|
||||||
|
XrmName *xrm_list)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
|
for (n = 0; n < _DT_HELP_FONT_END + 1; n++)
|
||||||
|
xrm_list[n] = CasualFontQuarks[n];
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Function: void _DtHelpGetStringQuarks (xrm_name)
|
* Function: void _DtHelpGetStringQuarks (xrm_name)
|
||||||
*
|
*
|
||||||
|
@ -744,6 +764,11 @@ __DtHelpFontDatabaseInit (
|
||||||
DefaultFontQuarks[_DT_HELP_FONT_CHAR_SET] =
|
DefaultFontQuarks[_DT_HELP_FONT_CHAR_SET] =
|
||||||
XrmStringToQuark ("ISO-8859-1");
|
XrmStringToQuark ("ISO-8859-1");
|
||||||
DefaultFontQuarks[_DT_HELP_FONT_END] = 0;
|
DefaultFontQuarks[_DT_HELP_FONT_END] = 0;
|
||||||
|
|
||||||
|
for (n = 0; n < _DT_HELP_FONT_END; ++n)
|
||||||
|
CasualFontQuarks[n] = XrmStringToQuark("*");
|
||||||
|
CasualFontQuarks[_DT_HELP_FONT_END] = 0;
|
||||||
|
|
||||||
QuarksInited = True;
|
QuarksInited = True;
|
||||||
}
|
}
|
||||||
_DtHelpProcessUnlock();
|
_DtHelpProcessUnlock();
|
||||||
|
|
|
@ -849,10 +849,17 @@ ResolveFont (
|
||||||
if (charset != NULL)
|
if (charset != NULL)
|
||||||
xrmList[_DT_HELP_FONT_CHAR_SET] = XrmStringToQuark(charset);
|
xrmList[_DT_HELP_FONT_CHAR_SET] = XrmStringToQuark(charset);
|
||||||
|
|
||||||
if (NULL == xlfdSpec ||
|
if (NULL != xlfdSpec)
|
||||||
_DtHelpGetExactFontIndex(pDAS,lang,charset,xlfdSpec,ret_idx)!=0)
|
result = _DtHelpGetExactFontIndex(pDAS,lang,charset,xlfdSpec,ret_idx);
|
||||||
|
|
||||||
|
if (result)
|
||||||
result = __DtHelpFontIndexGet (pDAS, xrmList, ret_idx);
|
result = __DtHelpFontIndexGet (pDAS, xrmList, ret_idx);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
_DtHelpCopyCasualList(xrmList);
|
||||||
|
result = __DtHelpFontIndexGet(pDAS, xrmList, ret_idx);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -353,6 +353,7 @@ internal _DtHelpCloseVolume
|
||||||
internal _DtHelpCommonHelpClean
|
internal _DtHelpCommonHelpClean
|
||||||
internal _DtHelpCommonHelpInit
|
internal _DtHelpCommonHelpInit
|
||||||
internal _DtHelpCopyDefaultList
|
internal _DtHelpCopyDefaultList
|
||||||
|
internal _DtHelpCopyCasualList
|
||||||
internal _DtHelpDABuildSelection
|
internal _DtHelpDABuildSelection
|
||||||
internal _DtHelpDADestroyGraphic
|
internal _DtHelpDADestroyGraphic
|
||||||
internal _DtHelpDADestroyRegion
|
internal _DtHelpDADestroyRegion
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue