本文整理汇总了C++中FontInfo::reduce方法的典型用法代码示例。如果您正苦于以下问题:C++ FontInfo::reduce方法的具体用法?C++ FontInfo::reduce怎么用?C++ FontInfo::reduce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontInfo
的用法示例。
在下文中一共展示了FontInfo::reduce方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: latexWriteEndChanges
/// Writes ending block of LaTeX needed to close use of this font
// Returns number of chars written
// This one corresponds to latexWriteStartChanges(). (Asger)
int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
OutputParams const & runparams,
Font const & base,
Font const & next,
bool const & closeLanguage) const
{
int count = 0;
bool env = false;
// reduce the current font to changes against the base
// font (of the layout). We use a temporary for this to
// avoid changing this font instance, as that would break
FontInfo f = bits_;
f.reduce(base.bits_);
if (f.family() != INHERIT_FAMILY) {
os << '}';
++count;
env = true; // Size change need not bother about closing env.
}
if (f.series() != INHERIT_SERIES) {
os << '}';
++count;
env = true; // Size change need not bother about closing env.
}
if (f.shape() != INHERIT_SHAPE) {
os << '}';
++count;
env = true; // Size change need not bother about closing env.
}
if (f.color() != Color_inherit && f.color() != Color_ignore) {
os << '}';
++count;
env = true; // Size change need not bother about closing env.
}
if (f.emph() == FONT_ON) {
os << '}';
++count;
env = true; // Size change need not bother about closing env.
}
if (f.noun() == FONT_ON) {
os << '}';
++count;
env = true; // Size change need not bother about closing env.
}
if (f.size() != FONT_SIZE_INHERIT) {
// We only have to close if only size changed
if (!env) {
os << '}';
++count;
}
}
if (f.underbar() == FONT_ON) {
os << '}';
++count;
runparams.inulemcmd = false;
}
if (f.strikeout() == FONT_ON) {
os << '}';
++count;
runparams.inulemcmd = false;
}
if (f.uuline() == FONT_ON) {
os << '}';
++count;
runparams.inulemcmd = false;
}
if (f.uwave() == FONT_ON) {
os << '}';
++count;
runparams.inulemcmd = false;
}
// If the current language is Hebrew, Arabic, or Farsi
// the numbers are written Left-to-Right. ArabTeX package
// reorders the number automatically but the packages used
// for Hebrew and Farsi (Arabi) do not.
if (bits_.number() == FONT_ON && next.fontInfo().number() != FONT_ON
&& (language()->lang() == "hebrew"
|| language()->lang() == "farsi"
|| language()->lang() == "arabic_arabi")) {
os << "\\endL}";
count += 6;
}
if (open_encoding_) {
// We need to close the encoding even if it does not change
// to do correct environment nesting
Encoding const * const ascii = encodings.fromLyXName("ascii");
pair<bool, int> const c = switchEncoding(os.os(), bparams,
runparams, *ascii);
LATTEST(c.first);
count += c.second;
runparams.encoding = ascii;
open_encoding_ = false;
}
//.........这里部分代码省略.........
示例2: latexWriteStartChanges
/// Writes the head of the LaTeX needed to impose this font
// Returns number of chars written.
int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
OutputParams const & runparams,
Font const & base,
Font const & prev) const
{
bool env = false;
int count = 0;
// polyglossia or babel?
if (runparams.use_polyglossia
&& language()->lang() != base.language()->lang()
&& language() != prev.language()) {
if (!language()->polyglossia().empty()) {
string tmp = "\\text" + language()->polyglossia();
if (!language()->polyglossiaOpts().empty())
tmp += "[" + language()->polyglossiaOpts() + "]";
tmp += "{";
os << from_ascii(tmp);
count += tmp.length();
} else {
os << '{';
count += 1;
}
} else if (language()->babel() != base.language()->babel() &&
language() != prev.language()) {
if (language()->lang() == "farsi") {
os << "\\textFR{";
count += 8;
} else if (!isRightToLeft() &&
base.language()->lang() == "farsi") {
os << "\\textLR{";
count += 8;
} else if (language()->lang() == "arabic_arabi") {
os << "\\textAR{";
count += 8;
} else if (!isRightToLeft() &&
base.language()->lang() == "arabic_arabi") {
os << "\\textLR{";
count += 8;
// currently the remaining RTL languages are arabic_arabtex and hebrew
} else if (isRightToLeft() != prev.isRightToLeft()) {
if (isRightToLeft()) {
os << "\\R{";
count += 3;
} else {
os << "\\L{";
count += 3;
}
} else if (!language()->babel().empty()) {
string const tmp =
subst(lyxrc.language_command_local,
"$$lang", language()->babel());
os << from_ascii(tmp);
count += tmp.length();
} else {
os << '{';
count += 1;
}
}
if (language()->encoding()->package() == Encoding::CJK) {
pair<bool, int> const c = switchEncoding(os, bparams,
runparams, *(language()->encoding()));
if (c.first) {
open_encoding_ = true;
count += c.second;
runparams.encoding = language()->encoding();
}
}
// If the current language is Hebrew, Arabic, or Farsi
// the numbers are written Left-to-Right. ArabTeX package
// reorders the number automatically but the packages used
// for Hebrew and Farsi (Arabi) do not.
if (bits_.number() == FONT_ON && prev.fontInfo().number() != FONT_ON
&& (language()->lang() == "hebrew"
|| language()->lang() == "farsi"
|| language()->lang() == "arabic_arabi")) {
os << "{\\beginL ";
count += 9;
}
FontInfo f = bits_;
f.reduce(base.bits_);
if (f.family() != INHERIT_FAMILY) {
os << '\\'
<< LaTeXFamilyNames[f.family()]
<< '{';
count += strlen(LaTeXFamilyNames[f.family()]) + 2;
env = true; //We have opened a new environment
}
if (f.series() != INHERIT_SERIES) {
os << '\\'
<< LaTeXSeriesNames[f.series()]
<< '{';
count += strlen(LaTeXSeriesNames[f.series()]) + 2;
//.........这里部分代码省略.........