version 1.19, 1999/07/02 13:06:51
|
version 1.20, 1999/07/06 09:16:57
|
Line 1179 ThotBool isHTML;
|
Line 1179 ThotBool isHTML;
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
ParseCSSFontWeight : parse a CSS font weight string |
ParseCSSFontWeight : parse a CSS font weight string |
we expect the input string describing the attribute to be |
we expect the input string describing the attribute to be |
extra-light, light, demi-light, medium, demi-bold, bold, extra-bold |
normal, bold, bolder, lighter, 100, 200, 300, ... 900, inherit. |
or a number encoding for the previous values |
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
static STRING ParseCSSFontWeight (Element element, PSchema tsch, |
static STRING ParseCSSFontWeight (Element element, PSchema tsch, |
Line 1195 CSSInfoPtr css;
|
Line 1194 CSSInfoPtr css;
|
ThotBool isHTML; |
ThotBool isHTML; |
#endif |
#endif |
{ |
{ |
PresentationValue weight, previous_style; |
PresentationValue weight; |
|
|
weight.typed_data.value = 0; |
weight.typed_data.value = 0; |
weight.typed_data.unit = STYLE_UNIT_REL; |
weight.typed_data.unit = STYLE_UNIT_REL; |
Line 1260 ThotBool isHTML;
|
Line 1259 ThotBool isHTML;
|
return (cssRule); |
return (cssRule); |
|
|
/* |
/* |
* Here we have to reduce since font weight is not well supported |
* Here we have to reduce since only two font weight values are supported |
* by the Thot presentation API. |
* by the Thot presentation API. |
*/ |
*/ |
if (!TtaGetStylePresentation (PRStyle, element, tsch, context, &previous_style)) |
if (weight.typed_data.value > 0) |
{ |
weight.typed_data.value = STYLE_WEIGHT_BOLD; |
if (previous_style.typed_data.value == STYLE_FONT_ITALICS || |
else |
previous_style.typed_data.value == STYLE_FONT_BOLDITALICS) |
weight.typed_data.value = STYLE_WEIGHT_NORMAL; |
if (weight.typed_data.value > 0) |
|
weight.typed_data.value = STYLE_FONT_BOLDITALICS; |
|
else |
|
weight.typed_data.value = STYLE_FONT_ITALICS; |
|
else if (previous_style.typed_data.value == STYLE_FONT_OBLIQUE || |
|
previous_style.typed_data.value == STYLE_FONT_BOLDOBLIQUE) |
|
if (weight.typed_data.value > 0) |
|
weight.typed_data.value = STYLE_FONT_BOLDOBLIQUE; |
|
else |
|
weight.typed_data.value = STYLE_FONT_OBLIQUE; |
|
else if (previous_style.typed_data.value == STYLE_FONT_ROMAN || |
|
previous_style.typed_data.value == STYLE_FONT_BOLD) |
|
if (weight.typed_data.value > 0) |
|
weight.typed_data.value = STYLE_FONT_BOLD; |
|
else |
|
weight.typed_data.value = STYLE_FONT_ROMAN; |
|
} |
|
else |
|
if (weight.typed_data.value > 0) |
|
weight.typed_data.value = STYLE_FONT_BOLD; |
|
else |
|
weight.typed_data.value = STYLE_FONT_ROMAN; |
|
|
|
/* install the new presentation */ |
/* install the new presentation */ |
TtaSetStylePresentation (PRStyle, element, tsch, context, weight); |
TtaSetStylePresentation (PRStyle, element, tsch, context, weight); |
return (cssRule); |
return (cssRule); |
} |
} |
|
|
Line 1394 ThotBool isHTML;
|
Line 1371 ThotBool isHTML;
|
* install the new presentation. |
* install the new presentation. |
*/ |
*/ |
if (style.typed_data.value != 0) |
if (style.typed_data.value != 0) |
{ |
TtaSetStylePresentation (PRStyle, element, tsch, context, style); |
PresentationValue previous_style; |
|
|
|
if (!TtaGetStylePresentation (PRStyle, element, tsch, context, &previous_style)) |
|
{ |
|
if (previous_style.typed_data.value == STYLE_FONT_BOLD) |
|
{ |
|
if (style.typed_data.value == STYLE_FONT_ITALICS) |
|
style.typed_data.value = STYLE_FONT_BOLDITALICS; |
|
if (style.typed_data.value == STYLE_FONT_OBLIQUE) |
|
style.typed_data.value = STYLE_FONT_BOLDOBLIQUE; |
|
} |
|
TtaSetStylePresentation (PRStyle, element, tsch, context, style); |
|
} |
|
else |
|
{ |
|
TtaSetStylePresentation (PRStyle, element, tsch, context, style); |
|
} |
|
} |
|
if (size.typed_data.value != 0) |
if (size.typed_data.value != 0) |
{ |
{ |
PresentationValue previous_size; |
PresentationValue previous_size; |
Line 3026 int len
|
Line 2985 int len
|
case PRStyle: |
case PRStyle: |
switch (settings->value.typed_data.value) |
switch (settings->value.typed_data.value) |
{ |
{ |
case STYLE_FONT_BOLD: |
|
ustrcpy (buffer, TEXT("font-weight: bold")); |
|
break; |
|
case STYLE_FONT_ROMAN: |
case STYLE_FONT_ROMAN: |
ustrcpy (buffer, TEXT("font-style: normal")); |
ustrcpy (buffer, TEXT("font-style: normal")); |
break; |
break; |
case STYLE_FONT_ITALICS: |
case STYLE_FONT_ITALICS: |
ustrcpy (buffer, TEXT("font-style: italic")); |
ustrcpy (buffer, TEXT("font-style: italic")); |
break; |
break; |
case STYLE_FONT_BOLDITALICS: |
|
ustrcpy (buffer, TEXT("font-weight: bold; font-style: italic")); |
|
break; |
|
case STYLE_FONT_OBLIQUE: |
case STYLE_FONT_OBLIQUE: |
ustrcpy (buffer, TEXT("font-style: oblique")); |
ustrcpy (buffer, TEXT("font-style: oblique")); |
break; |
break; |
case STYLE_FONT_BOLDOBLIQUE: |
} |
ustrcpy (buffer, TEXT("font-weight: bold; font-style: oblique")); |
break; |
|
case PRWeight: |
|
switch (settings->value.typed_data.value) |
|
{ |
|
case STYLE_WEIGHT_BOLD: |
|
ustrcpy (buffer, TEXT("font-weight: bold")); |
|
break; |
|
case STYLE_WEIGHT_NORMAL: |
|
ustrcpy (buffer, TEXT("font-weight: normal")); |
break; |
break; |
} |
} |
break; |
break; |