# FontEncoding <font encoding|font encoding|...>
# InternalEncoding <true|false>
# RTL <true|false>
+# WordWrap <true|false>
# LangCode <language_code>
# LangVariety <language_variety>
# PreBabelPreamble
# If True, LyX takes care for characters/macros that do not exist in
# some font encodings ("<", ">", "|" and straight quote).
# It is not required for standard encodings like T2A. See bug #5091.
+# * WordWrap is only used for on-screen display: when is is true (the default), rows are broken
+# at word boundary; otherwise, they can be ended at arbitrary position. This
+# setting is useful for CJK languages.
# * LangCode is also used for spellchecking and thesaurus, where the
# dictionaries are named accordingly. Thus, check this when introducing/
# changing language codes (especially aspell, thesaurus).
HasGuiSupport true
Encoding euc-cn
QuoteStyle english
+ WordWrap false
LangCode zh_CN
DateFormats "yyyy年M月d日|yyyy-M-d|yy-M-d"
Requires CJK
HasGuiSupport true
QuoteStyle cjk
Encoding utf8-cjk
+ WordWrap false
LangCode zh_TW
DateFormats "yyyy年M月d日|yyyy年M月d日|yy年M月d日"
Requires CJK
HasGuiSupport true
BabelName japanese
Encoding jis-platex
+ WordWrap false
LangCode ja_JP
Requires japanese
FontEncoding ASCII
Language japanese-cjk
GuiName "Japanese (CJK)"
Encoding euc-jp
- DateFormats "yyyy年M月d日|yyyy/MM/dd|yy/MM/dd"
+ DateFormats "yyyy年M月d日|yyyy/MM/dd|yy/MM/dd"
+ WordWrap false
LangCode ja_JP
Requires CJK
QuoteStyle cjk
Encoding euc-kr
QuoteStyle cjkangle
DateFormats "yyyy년 M월 d일|yyyy. M. d.|yy. M. d."
+ WordWrap false
LangCode ko_KR
Requires CJK
End
LA_PROVIDES,
LA_REQUIRES,
LA_QUOTESTYLE,
- LA_RTL
+ LA_RTL,
+ LA_WORDWRAP
};
// Keep these sorted alphabetically!
{ "provides", LA_PROVIDES },
{ "quotestyle", LA_QUOTESTYLE },
{ "requires", LA_REQUIRES },
- { "rtl", LA_RTL }
+ { "rtl", LA_RTL },
+ {"wordwrap", LA_WORDWRAP }
};
bool error = false;
case LA_RTL:
lex >> rightToLeft_;
break;
+ case LA_WORDWRAP:
+ lex >> word_wrap_;
+ break;
}
}
lex.popTable();
public:
///
Language() : rightToLeft_(false), encoding_(0), internal_enc_(false),
- has_gui_support_(false) {}
+ has_gui_support_(false), word_wrap_(true) {}
/// LyX language name
std::string const lang() const { return lang_; }
/// Babel language name
std::string const display() const { return display_; }
/// is this a RTL language?
bool rightToLeft() const { return rightToLeft_; }
+ /// shall text be wrapped at word boundary ?
+ bool wordWrap() const { return word_wrap_; }
/**
* Translate a string from the layout files that appears in the output.
* It takes the translations from lib/layouttranslations instead of
///
bool has_gui_support_;
///
+ bool word_wrap_;
+ ///
TranslationMap layoutTranslations_;
};
* FIXME: hardcoding languages is bad. Put this information in
* `languages' file.
*/
- string const lang = brk.font.language()->lang();
- bool force = lang == "chinese-simplified"
- || lang == "chinese-traditional"
- || lang == "japanese"
- || lang == "korean";
- // FIXME: is it important to check for separators?
- if ((!force && brk.countSeparators() == 0) || brk.pos < keep)
+ bool const word_wrap = brk.font.language()->wordWrap();
+ // When there is text before the body part (think description
+ // environment), do not try to break.
+ if (brk.pos < keep)
continue;
/* We have found a suitable separable element. This is the common case.
* Try to break it cleanly (at word boundary) at a length that is both
* - shorter than the natural width of the element, in order to enforce
* break-up.
*/
- if (brk.breakAt(min(w - wid_brk, brk.dim.wid - 2), force)) {
+ if (brk.breakAt(min(w - wid_brk, brk.dim.wid - 2), !word_wrap)) {
/* if this element originally did not cause a row overflow
* in itself, and the remainder of the row would still be
* too large after breaking, then we will have issues in