mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Get font families working for XHTML.
This commit is contained in:
parent
b383d04e07
commit
c713030edb
@ -2865,6 +2865,8 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf,
|
|||||||
bool wave_flag = false;
|
bool wave_flag = false;
|
||||||
// shape tags
|
// shape tags
|
||||||
bool shap_flag = false;
|
bool shap_flag = false;
|
||||||
|
// family tags
|
||||||
|
bool faml_flag = false;
|
||||||
|
|
||||||
Layout const & style = *d->layout_;
|
Layout const & style = *d->layout_;
|
||||||
|
|
||||||
@ -2874,6 +2876,10 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf,
|
|||||||
style.labeltype == LABEL_MANUAL ? style.labelfont : style.font;
|
style.labeltype == LABEL_MANUAL ? style.labelfont : style.font;
|
||||||
|
|
||||||
FontShape curr_fs = INHERIT_SHAPE;
|
FontShape curr_fs = INHERIT_SHAPE;
|
||||||
|
FontFamily curr_fam = INHERIT_FAMILY;
|
||||||
|
|
||||||
|
string const default_family =
|
||||||
|
buf.masterBuffer()->params().fonts_default_family;
|
||||||
|
|
||||||
vector<html::FontTag> tagsToOpen;
|
vector<html::FontTag> tagsToOpen;
|
||||||
vector<html::EndFontTag> tagsToClose;
|
vector<html::EndFontTag> tagsToClose;
|
||||||
@ -2949,12 +2955,15 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf,
|
|||||||
switch (curr_fs) {
|
switch (curr_fs) {
|
||||||
case ITALIC_SHAPE:
|
case ITALIC_SHAPE:
|
||||||
tagsToOpen.push_back(html::FontTag(html::FT_ITALIC));
|
tagsToOpen.push_back(html::FontTag(html::FT_ITALIC));
|
||||||
|
shap_flag = true;
|
||||||
break;
|
break;
|
||||||
case SLANTED_SHAPE:
|
case SLANTED_SHAPE:
|
||||||
tagsToOpen.push_back(html::FontTag(html::FT_SLANTED));
|
tagsToOpen.push_back(html::FontTag(html::FT_SLANTED));
|
||||||
|
shap_flag = true;
|
||||||
break;
|
break;
|
||||||
case SMALLCAPS_SHAPE:
|
case SMALLCAPS_SHAPE:
|
||||||
tagsToOpen.push_back(html::FontTag(html::FT_SMALLCAPS));
|
tagsToOpen.push_back(html::FontTag(html::FT_SMALLCAPS));
|
||||||
|
shap_flag = true;
|
||||||
break;
|
break;
|
||||||
case UP_SHAPE:
|
case UP_SHAPE:
|
||||||
case INHERIT_SHAPE:
|
case INHERIT_SHAPE:
|
||||||
@ -2964,7 +2973,59 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf,
|
|||||||
LATTEST(false);
|
LATTEST(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
shap_flag = true;
|
}
|
||||||
|
|
||||||
|
curr_fam = font.fontInfo().family();
|
||||||
|
FontFamily old_fam = font_old.family();
|
||||||
|
if (old_fam != curr_fam) {
|
||||||
|
if (faml_flag) {
|
||||||
|
switch (old_fam) {
|
||||||
|
case ROMAN_FAMILY:
|
||||||
|
tagsToClose.push_back(html::EndFontTag(html::FT_ROMAN));
|
||||||
|
break;
|
||||||
|
case SANS_FAMILY:
|
||||||
|
tagsToClose.push_back(html::EndFontTag(html::FT_SANS));
|
||||||
|
break;
|
||||||
|
case TYPEWRITER_FAMILY:
|
||||||
|
tagsToClose.push_back(html::EndFontTag(html::FT_TYPE));
|
||||||
|
break;
|
||||||
|
case INHERIT_FAMILY:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// the other tags are for internal use
|
||||||
|
LATTEST(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
faml_flag = false;
|
||||||
|
}
|
||||||
|
switch (curr_fam) {
|
||||||
|
case ROMAN_FAMILY:
|
||||||
|
// we will treat a "default" font family as roman, since we have
|
||||||
|
// no other idea what to do.
|
||||||
|
if (default_family != "rmdefault" && default_family != "default") {
|
||||||
|
tagsToOpen.push_back(html::FontTag(html::FT_ROMAN));
|
||||||
|
faml_flag = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SANS_FAMILY:
|
||||||
|
if (default_family != "sfdefault") {
|
||||||
|
tagsToOpen.push_back(html::FontTag(html::FT_SANS));
|
||||||
|
faml_flag = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TYPEWRITER_FAMILY:
|
||||||
|
if (default_family != "ttdefault") {
|
||||||
|
tagsToOpen.push_back(html::FontTag(html::FT_TYPE));
|
||||||
|
faml_flag = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case INHERIT_FAMILY:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// the other tags are for internal use
|
||||||
|
LATTEST(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME XHTML
|
// FIXME XHTML
|
||||||
|
@ -600,7 +600,8 @@ XHTMLStream & XHTMLStream::operator<<(html::EndTag const & etag)
|
|||||||
// it was pending, so we just erase it
|
// it was pending, so we just erase it
|
||||||
writeError("Tried to close pending tag `" + etag.tag_
|
writeError("Tried to close pending tag `" + etag.tag_
|
||||||
+ "' when other tags were pending. Last pending tag is `"
|
+ "' when other tags were pending. Last pending tag is `"
|
||||||
+ pending_tags_.back()->tag_ + "'. Tag discarded.");
|
+ to_utf8(pending_tags_.back()->writeTag())
|
||||||
|
+ "'. Tag discarded.");
|
||||||
pending_tags_.erase(dit);
|
pending_tags_.erase(dit);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -617,7 +618,7 @@ XHTMLStream & XHTMLStream::operator<<(html::EndTag const & etag)
|
|||||||
string estr = "Closing tag `" + etag.tag_
|
string estr = "Closing tag `" + etag.tag_
|
||||||
+ "' when other tags are pending. Discarded pending tags:\n";
|
+ "' when other tags are pending. Discarded pending tags:\n";
|
||||||
for (dit = pending_tags_.begin(); dit != den; ++dit)
|
for (dit = pending_tags_.begin(); dit != den; ++dit)
|
||||||
estr += (*dit)->tag_ + "\n";
|
estr += to_utf8(html::htmlize((*dit)->writeTag(), XHTMLStream::ESCAPE_ALL)) + "\n";
|
||||||
writeError(estr);
|
writeError(estr);
|
||||||
// clear the pending tags...
|
// clear the pending tags...
|
||||||
pending_tags_.clear();
|
pending_tags_.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user