/*
******************************************************************************
- * Copyright (C) 1998-2003, International Business Machines Corporation and *
+ * © 2016 and later: Unicode, Inc. and others. *
+ * License & terms of use: http://www.unicode.org/copyright.html#License *
+ ******************************************************************************
+ ******************************************************************************
+ * Copyright (C) 1998-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
******************************************************************************
*/
: fPointSize(pointSize), fFontCount(0), fAscent(0), fDescent(0), fLeading(0), fGUISupport(guiSupport)
{
le_int32 defaultFont = -1, i, script;
+ le_bool haveFonts = FALSE;
+/**/
for (i = 0; i < scriptCodeCount; i += 1) {
fFontIndices[i] = -1;
fFontNames[i] = NULL;
fFontInstances[i] = NULL;
}
+ /**/
if (LE_FAILURE(status)) {
return;
if (strcmp(scriptName, "DEFAULT") == 0) {
defaultFont = getFontIndex(fontName);
+ haveFonts = TRUE;
continue;
}
- uscript_getCode(scriptName, &scriptCode, 1, &scriptStatus);
+ le_int32 fillCount = uscript_getCode(scriptName, &scriptCode, 1, &scriptStatus);
- if (U_FAILURE(scriptStatus) || scriptStatus == U_USING_FALLBACK_WARNING ||
- scriptStatus == U_USING_DEFAULT_WARNING) {
+ if (U_FAILURE(scriptStatus) || fillCount <= 0 ||
+ scriptStatus == U_USING_FALLBACK_WARNING || scriptStatus == U_USING_DEFAULT_WARNING) {
sprintf(errorMessage, "The script name %s is invalid.", line);
fGUISupport->postErrorMessage(errorMessage, "Font Map Error");
- status = LE_ILLEGAL_ARGUMENT_ERROR;
- fclose(file);
- return;
+ continue;
}
script = (le_int32) scriptCode;
}
fFontIndices[script] = getFontIndex(fontName);
+ haveFonts = TRUE;
}
if (defaultFont >= 0) {
}
}
+ if (! haveFonts) {
+ sprintf(errorMessage, "The font map file %s does not contain any valid scripts.", fileName);
+ fGUISupport->postErrorMessage(errorMessage, "Font Map Error");
+ status = LE_ILLEGAL_ARGUMENT_ERROR;
+ }
+
fclose(file);
}