mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23891 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f8afb49165
commit
6b28f08ff2
@ -1959,7 +1959,7 @@ string const BufferParams::loadFonts(string const & rm,
|
||||
else if (tt == "courier" )
|
||||
os << "\\usepackage{" << tt << "}\n";
|
||||
// Computer Modern, Latin Modern, CM Bright
|
||||
else if (tt != "default")
|
||||
else if (tt != "default")
|
||||
os << "\\renewcommand{\\ttdefault}{" << tt << "}\n";
|
||||
|
||||
return os.str();
|
||||
@ -1969,14 +1969,13 @@ string const BufferParams::loadFonts(string const & rm,
|
||||
Encoding const & BufferParams::encoding() const
|
||||
{
|
||||
if (inputenc == "auto" || inputenc == "default")
|
||||
return *(language->encoding());
|
||||
Encoding const * const enc =
|
||||
encodings.getFromLaTeXName(inputenc);
|
||||
return *language->encoding();
|
||||
Encoding const * const enc = encodings.fromLaTeXName(inputenc);
|
||||
if (enc)
|
||||
return *enc;
|
||||
lyxerr << "Unknown inputenc value `" << inputenc
|
||||
<< "'. Using `auto' instead." << endl;
|
||||
return *(language->encoding());
|
||||
LYXERR0("Unknown inputenc value `" << inputenc
|
||||
<< "'. Using `auto' instead.");
|
||||
return *language->encoding();
|
||||
}
|
||||
|
||||
|
||||
|
@ -261,7 +261,7 @@ const char * EncodingException::what() const throw()
|
||||
|
||||
Encoding::Encoding(string const & n, string const & l, string const & i,
|
||||
bool f, Encoding::Package p)
|
||||
: Name_(n), LatexName_(l), iconvName_(i), fixedwidth_(f), package_(p)
|
||||
: name_(n), latexName_(l), iconvName_(i), fixedwidth_(f), package_(p)
|
||||
{
|
||||
if (n == "ascii") {
|
||||
// ASCII can encode 128 code points and nothing else
|
||||
@ -372,7 +372,7 @@ void Encodings::validate(char_type c, LaTeXFeatures & features)
|
||||
}
|
||||
|
||||
|
||||
bool Encodings::isComposeChar_hebrew(char_type c)
|
||||
bool Encodings::isHebrewComposeChar(char_type c)
|
||||
{
|
||||
return c <= 0x05c2 && c >= 0x05b0 && c != 0x05be && c != 0x05c0;
|
||||
}
|
||||
@ -382,7 +382,7 @@ bool Encodings::isComposeChar_hebrew(char_type c)
|
||||
// they are hamza, alef_madda, alef_hamza, waw_hamza, alef_hamza_under,
|
||||
// alef, tah_marbota, dal, thal, rah, zai, wow, alef_maksoura
|
||||
|
||||
bool Encodings::is_arabic_special(char_type c)
|
||||
bool Encodings::isArabicSpecialChar(char_type c)
|
||||
{
|
||||
return (c >= 0x0621 && c <= 0x0625) || (c >= 0x0630 && c <= 0x0632)
|
||||
|| c == 0x0627 || c == 0x0629 || c == 0x062f || c == 0x0648
|
||||
@ -390,22 +390,22 @@ bool Encodings::is_arabic_special(char_type c)
|
||||
}
|
||||
|
||||
|
||||
bool Encodings::isComposeChar_arabic(char_type c)
|
||||
bool Encodings::isArabicComposeChar(char_type c)
|
||||
{
|
||||
return c >= 0x064b && c <= 0x0652;
|
||||
}
|
||||
|
||||
|
||||
bool Encodings::is_arabic(char_type c)
|
||||
bool Encodings::isArabicChar(char_type c)
|
||||
{
|
||||
return c >= arabic_start && c <= arabic_end
|
||||
&& arabic_table[c-arabic_start][0];
|
||||
}
|
||||
|
||||
|
||||
char_type Encodings::transformChar(char_type c, Encodings::Letter_Form form)
|
||||
char_type Encodings::transformChar(char_type c, Encodings::LetterForm form)
|
||||
{
|
||||
return is_arabic(c) ? arabic_table[c-arabic_start][form] : c;
|
||||
return isArabicChar(c) ? arabic_table[c-arabic_start][form] : c;
|
||||
}
|
||||
|
||||
|
||||
@ -436,14 +436,14 @@ bool Encodings::isKnownScriptChar(char_type const c, string & preamble)
|
||||
}
|
||||
|
||||
|
||||
Encoding const * Encodings::getFromLyXName(string const & name) const
|
||||
Encoding const * Encodings::fromLyXName(string const & name) const
|
||||
{
|
||||
EncodingList::const_iterator const it = encodinglist.find(name);
|
||||
return it != encodinglist.end() ? &it->second : 0;
|
||||
}
|
||||
|
||||
|
||||
Encoding const * Encodings::getFromLaTeXName(string const & name) const
|
||||
Encoding const * Encodings::fromLaTeXName(string const & name) const
|
||||
{
|
||||
// We don't use find_if because it makes copies of the pairs in
|
||||
// the map.
|
||||
|
@ -55,9 +55,9 @@ public:
|
||||
///
|
||||
void init() const;
|
||||
///
|
||||
std::string const & name() const { return Name_; }
|
||||
std::string const & name() const { return name_; }
|
||||
///
|
||||
std::string const & latexName() const { return LatexName_; }
|
||||
std::string const & latexName() const { return latexName_; }
|
||||
///
|
||||
std::string const & iconvName() const { return iconvName_; }
|
||||
/**
|
||||
@ -75,9 +75,9 @@ public:
|
||||
std::vector<char_type> symbolsList() const;
|
||||
private:
|
||||
///
|
||||
std::string Name_;
|
||||
std::string name_;
|
||||
///
|
||||
std::string LatexName_;
|
||||
std::string latexName_;
|
||||
///
|
||||
std::string iconvName_;
|
||||
/// Is this a fixed width encoding?
|
||||
@ -125,9 +125,9 @@ public:
|
||||
void read(support::FileName const & encfile,
|
||||
support::FileName const & symbolsfile);
|
||||
/// Get encoding from LyX name \p name
|
||||
Encoding const * getFromLyXName(std::string const & name) const;
|
||||
Encoding const * fromLyXName(std::string const & name) const;
|
||||
/// Get encoding from LaTeX name \p name
|
||||
Encoding const * getFromLaTeXName(std::string const & name) const;
|
||||
Encoding const * fromLaTeXName(std::string const & name) const;
|
||||
|
||||
///
|
||||
const_iterator begin() const { return encodinglist.begin(); }
|
||||
@ -135,7 +135,7 @@ public:
|
||||
const_iterator end() const { return encodinglist.end(); }
|
||||
|
||||
///
|
||||
enum Letter_Form {
|
||||
enum LetterForm {
|
||||
///
|
||||
FORM_ISOLATED,
|
||||
///
|
||||
@ -146,15 +146,15 @@ public:
|
||||
FORM_MEDIAL
|
||||
};
|
||||
///
|
||||
static bool isComposeChar_hebrew(char_type c);
|
||||
static bool isHebrewComposeChar(char_type c);
|
||||
///
|
||||
static bool isComposeChar_arabic(char_type c);
|
||||
static bool isArabicComposeChar(char_type c);
|
||||
///
|
||||
static bool is_arabic_special(char_type c);
|
||||
static bool isArabicSpecialChar(char_type c);
|
||||
///
|
||||
static bool is_arabic(char_type c);
|
||||
static bool isArabicChar(char_type c);
|
||||
///
|
||||
static char_type transformChar(char_type c, Letter_Form form);
|
||||
static char_type transformChar(char_type c, LetterForm form);
|
||||
/// Is this a combining char?
|
||||
static bool isCombiningChar(char_type c);
|
||||
/**
|
||||
|
@ -620,7 +620,7 @@ int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams,
|
||||
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.getFromLyXName("ascii");
|
||||
Encoding const * const ascii = encodings.fromLyXName("ascii");
|
||||
pair<bool, int> const c = switchEncoding(os, bparams,
|
||||
runparams, *ascii);
|
||||
BOOST_ASSERT(c.first);
|
||||
|
@ -42,7 +42,7 @@ void Languages::read(FileName const & filename)
|
||||
{
|
||||
// We need to set the encoding of latex_lang
|
||||
latex_lang = Language("latex", "", "Latex", false, "iso8859-1",
|
||||
encodings.getFromLyXName("iso8859-1"),
|
||||
encodings.fromLyXName("iso8859-1"),
|
||||
"latex", "");
|
||||
|
||||
Lexer lex(0, 0);
|
||||
@ -75,9 +75,9 @@ void Languages::read(FileName const & filename)
|
||||
if (lex.next())
|
||||
latex_options = lex.getString();
|
||||
|
||||
Encoding const * encoding = encodings.getFromLyXName(encoding_str);
|
||||
Encoding const * encoding = encodings.fromLyXName(encoding_str);
|
||||
if (!encoding) {
|
||||
encoding = encodings.getFromLyXName("iso8859-1");
|
||||
encoding = encodings.fromLyXName("iso8859-1");
|
||||
lyxerr << "Unknown encoding " << encoding_str << endl;
|
||||
}
|
||||
|
||||
|
@ -2406,7 +2406,7 @@ bool Paragraph::allowEmpty() const
|
||||
|
||||
char_type Paragraph::transformChar(char_type c, pos_type pos) const
|
||||
{
|
||||
if (!Encodings::is_arabic(c))
|
||||
if (!Encodings::isArabicChar(c))
|
||||
return c;
|
||||
|
||||
char_type prev_char = ' ';
|
||||
@ -2414,7 +2414,7 @@ char_type Paragraph::transformChar(char_type c, pos_type pos) const
|
||||
|
||||
for (pos_type i = pos - 1; i >= 0; --i) {
|
||||
char_type const par_char = d->text_[i];
|
||||
if (!Encodings::isComposeChar_arabic(par_char)) {
|
||||
if (!Encodings::isArabicComposeChar(par_char)) {
|
||||
prev_char = par_char;
|
||||
break;
|
||||
}
|
||||
@ -2422,21 +2422,21 @@ char_type Paragraph::transformChar(char_type c, pos_type pos) const
|
||||
|
||||
for (pos_type i = pos + 1, end = size(); i < end; ++i) {
|
||||
char_type const par_char = d->text_[i];
|
||||
if (!Encodings::isComposeChar_arabic(par_char)) {
|
||||
if (!Encodings::isArabicComposeChar(par_char)) {
|
||||
next_char = par_char;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Encodings::is_arabic(next_char)) {
|
||||
if (Encodings::is_arabic(prev_char) &&
|
||||
!Encodings::is_arabic_special(prev_char))
|
||||
if (Encodings::isArabicChar(next_char)) {
|
||||
if (Encodings::isArabicChar(prev_char) &&
|
||||
!Encodings::isArabicSpecialChar(prev_char))
|
||||
return Encodings::transformChar(c, Encodings::FORM_MEDIAL);
|
||||
else
|
||||
return Encodings::transformChar(c, Encodings::FORM_INITIAL);
|
||||
} else {
|
||||
if (Encodings::is_arabic(prev_char) &&
|
||||
!Encodings::is_arabic_special(prev_char))
|
||||
if (Encodings::isArabicChar(prev_char) &&
|
||||
!Encodings::isArabicSpecialChar(prev_char))
|
||||
return Encodings::transformChar(c, Encodings::FORM_FINAL);
|
||||
else
|
||||
return Encodings::transformChar(c, Encodings::FORM_ISOLATED);
|
||||
|
@ -226,11 +226,11 @@ int ParagraphMetrics::singleWidth(pos_type pos, Font const & font) const
|
||||
if (language->lang() == "arabic_arabtex" ||
|
||||
language->lang() == "arabic_arabi" ||
|
||||
language->lang() == "farsi") {
|
||||
if (Encodings::isComposeChar_arabic(c))
|
||||
if (Encodings::isArabicComposeChar(c))
|
||||
return 0;
|
||||
c = par_->transformChar(c, pos);
|
||||
} else if (language->lang() == "hebrew" &&
|
||||
Encodings::isComposeChar_hebrew(c)) {
|
||||
Encodings::isHebrewComposeChar(c)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ public:
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void reset(QList<char_type> const & symbols)
|
||||
void setSymbols(QList<char_type> const & symbols)
|
||||
{
|
||||
symbols_ = symbols;
|
||||
QAbstractItemModel::reset();
|
||||
@ -404,7 +404,7 @@ void GuiSymbols::updateSymbolList(bool update_combo)
|
||||
bool const show_all = categoryFilterCB->isChecked();
|
||||
|
||||
if (symbols_.empty() || update_combo)
|
||||
symbols_ = encodings.getFromLyXName(encoding_)->symbolsList();
|
||||
symbols_ = encodings.fromLyXName(encoding_)->symbolsList();
|
||||
|
||||
if (!show_all) {
|
||||
for (int i = 0 ; i < no_blocks; ++i)
|
||||
@ -441,7 +441,7 @@ void GuiSymbols::updateSymbolList(bool update_combo)
|
||||
used_blocks[block] = numItem;
|
||||
}
|
||||
}
|
||||
model_->reset(s);
|
||||
model_->setSymbols(s);
|
||||
|
||||
if (update_combo) {
|
||||
// update category combo
|
||||
|
@ -173,7 +173,7 @@ void RowPainter::paintHebrewComposeChar(pos_type & vpos, FontInfo const & font)
|
||||
|
||||
for (pos_type i = pos - 1; i >= 0; --i) {
|
||||
c = par_.getChar(i);
|
||||
if (!Encodings::isComposeChar_hebrew(c)) {
|
||||
if (!Encodings::isHebrewComposeChar(c)) {
|
||||
if (isPrintableNonspace(c)) {
|
||||
int const width2 = pm_.singleWidth(i,
|
||||
text_metrics_.displayFont(pit_, i));
|
||||
@ -207,7 +207,7 @@ void RowPainter::paintArabicComposeChar(pos_type & vpos, FontInfo const & font)
|
||||
|
||||
for (pos_type i = pos - 1; i >= 0; --i) {
|
||||
c = par_.getChar(i);
|
||||
if (!Encodings::isComposeChar_arabic(c)) {
|
||||
if (!Encodings::isArabicComposeChar(c)) {
|
||||
if (isPrintableNonspace(c)) {
|
||||
int const width2 = pm_.singleWidth(i,
|
||||
text_metrics_.displayFont(pit_, i));
|
||||
@ -277,10 +277,10 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
|
||||
* of arabic and hebrew characters, then these breaks may have
|
||||
* to be re-applied.
|
||||
|
||||
if (arabic && Encodings::isComposeChar_arabic(c))
|
||||
if (arabic && Encodings::isArabicComposeChar(c))
|
||||
break;
|
||||
|
||||
if (hebrew && Encodings::isComposeChar_hebrew(c))
|
||||
if (hebrew && Encodings::isHebrewComposeChar(c))
|
||||
break;
|
||||
*/
|
||||
|
||||
@ -345,8 +345,8 @@ void RowPainter::paintFromPos(pos_type & vpos)
|
||||
|
||||
// draw as many chars as we can
|
||||
if ((!hebrew && !arabic)
|
||||
|| (hebrew && !Encodings::isComposeChar_hebrew(c))
|
||||
|| (arabic && !Encodings::isComposeChar_arabic(c))) {
|
||||
|| (hebrew && !Encodings::isHebrewComposeChar(c))
|
||||
|| (arabic && !Encodings::isArabicComposeChar(c))) {
|
||||
paintChars(vpos, orig_font.fontInfo(), hebrew, arabic);
|
||||
} else if (hebrew) {
|
||||
paintHebrewComposeChar(vpos, orig_font.fontInfo());
|
||||
|
Loading…
Reference in New Issue
Block a user