version 1.368, 2006/10/16 16:06:09
|
version 1.369, 2006/11/03 15:12:33
|
Line 486 char *ParseNumber (char *cssRule, Presen
|
Line 486 char *ParseNumber (char *cssRule, Presen
|
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
ParseCSSUnit: |
ParseCSSUnit: |
parse a CSS Unit substring and returns the corresponding |
parse a number followed by a CSS Unit and returns the corresponding |
value and its unit. |
value and its unit. |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
char *ParseCSSUnit (char *cssRule, PresentationValue *pval) |
char *ParseCSSUnit (char *cssRule, PresentationValue *pval) |
Line 500 char *ParseCSSUnit (char *cssRule, Prese
|
Line 500 char *ParseCSSUnit (char *cssRule, Prese
|
cssRule = SkipWord (cssRule); |
cssRule = SkipWord (cssRule); |
else |
else |
{ |
{ |
|
/* is there a space after the number? */ |
p = cssRule; |
p = cssRule; |
cssRule = SkipBlanksAndComments (cssRule); |
cssRule = SkipBlanksAndComments (cssRule); |
if (p == cssRule) |
if (p == cssRule) |
|
/* no space */ |
p = NULL; |
p = NULL; |
|
else |
|
/* a space is here. restore the pointer */ |
|
cssRule = p; |
uni = 0; |
uni = 0; |
while (CSSUnitNames[uni].sign) |
while (CSSUnitNames[uni].sign) |
{ |
{ |
if (!strncasecmp (CSSUnitNames[uni].sign, cssRule, |
if (!strncasecmp (CSSUnitNames[uni].sign, cssRule, |
strlen (CSSUnitNames[uni].sign))) |
strlen (CSSUnitNames[uni].sign))) |
|
/* this is a correct unit */ |
{ |
{ |
pval->typed_data.unit = CSSUnitNames[uni].unit; |
pval->typed_data.unit = CSSUnitNames[uni].unit; |
if (p) |
if (p) |
|
/* there was a space before the unit. Syntax error */ |
pval->typed_data.unit = UNIT_INVALID; |
pval->typed_data.unit = UNIT_INVALID; |
return (cssRule + strlen (CSSUnitNames[uni].sign)); |
return (cssRule + strlen (CSSUnitNames[uni].sign)); |
} |
} |
else |
else |
uni++; |
uni++; |
} |
} |
/* not in the list of predefined units */ |
/* not in the list of accepted units */ |
pval->typed_data.unit = UNIT_BOX; |
pval->typed_data.unit = UNIT_BOX; |
} |
} |
if (p) |
|
pval->typed_data.unit = UNIT_INVALID; |
|
return (cssRule); |
return (cssRule); |
} |
} |
|
|
Line 2945 static char *ParseACSSFontSize (Element
|
Line 2950 static char *ParseACSSFontSize (Element
|
{ |
{ |
ElementType elType; |
ElementType elType; |
PresentationValue pval; |
PresentationValue pval; |
char *ptr = NULL, *ptr1 = NULL; |
char *ptr = NULL, *ptr1 = NULL, *ptr2 = NULL; |
char *start_value; |
char *start_value; |
ThotBool real, linespace = FALSE; |
ThotBool real, error, linespace = FALSE; |
|
|
|
error = FALSE; |
pval.typed_data.real = FALSE; |
pval.typed_data.real = FALSE; |
cssRule = SkipBlanksAndComments (cssRule); |
cssRule = SkipBlanksAndComments (cssRule); |
start_value = cssRule; |
start_value = cssRule; |
Line 3031 static char *ParseACSSFontSize (Element
|
Line 3037 static char *ParseACSSFontSize (Element
|
{ |
{ |
if (!check) |
if (!check) |
cssRule = SkipValue ("Invalid font-size value", cssRule); |
cssRule = SkipValue ("Invalid font-size value", cssRule); |
return (cssRule); |
error = TRUE; |
} |
} |
else |
else |
{ |
{ |
Line 3049 static char *ParseACSSFontSize (Element
|
Line 3055 static char *ParseACSSFontSize (Element
|
pval.typed_data.unit == UNIT_BOX || |
pval.typed_data.unit == UNIT_BOX || |
pval.typed_data.value < 0)) |
pval.typed_data.value < 0)) |
/* not a valid value */ |
/* not a valid value */ |
return (cssRule); |
{ |
|
if (!check) |
|
{ |
|
ptr2 = SkipWord (cssRule); |
|
CSSParseError ("Invalid font-size value", ptr1, ptr2); |
|
} |
|
error = TRUE; |
|
} |
else if (pval.typed_data.unit == UNIT_REL && pval.typed_data.value > 0) |
else if (pval.typed_data.unit == UNIT_REL && pval.typed_data.value > 0) |
/* CSS relative sizes have to be higher than Thot ones */ |
/* CSS relative sizes have to be higher than Thot ones */ |
pval.typed_data.value += 1; |
pval.typed_data.value += 1; |
Line 3089 static char *ParseACSSFontSize (Element
|
Line 3102 static char *ParseACSSFontSize (Element
|
} |
} |
|
|
/* install the presentation style */ |
/* install the presentation style */ |
if (!check) |
if (!check && !error) |
{ |
{ |
if (DoDialog) |
if (DoDialog) |
DisplayStyleValue ("font-size", start_value, cssRule); |
DisplayStyleValue ("font-size", start_value, cssRule); |