diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CallTip.cxx | 7 | ||||
| -rw-r--r-- | src/CallTip.h | 3 | ||||
| -rw-r--r-- | src/Editor.cxx | 10 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 1 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 15 | ||||
| -rw-r--r-- | src/ViewStyle.h | 5 | 
6 files changed, 34 insertions, 7 deletions
| diff --git a/src/CallTip.cxx b/src/CallTip.cxx index 22f559ef7..f9f3ce7f7 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -272,7 +272,9 @@ void CallTip::MouseClick(Point pt) noexcept {  PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn,                                   const char *faceName, int size,                                   int codePage_, int characterSet, -								 int technology, const Window &wParent) { +                                 int technology, +                                 const char *localeName, +                                 const Window &wParent) {  	clickPlace = 0;  	val = defn;  	codePage = codePage_; @@ -283,7 +285,8 @@ PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, co  	inCallTipMode = true;  	posStartCallTip = pos;  	const XYPOSITION deviceHeight = static_cast<XYPOSITION>(surfaceMeasure->DeviceHeightFont(size)); -	const FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet); +	const FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, +		false, 0, technology, characterSet, localeName);  	font = Font::Allocate(fp);  	// Look for multiple lines in the text  	// Only support \n here - simply means container must avoid \r! diff --git a/src/CallTip.h b/src/CallTip.h index 6cc89d3a5..f1358a94a 100644 --- a/src/CallTip.h +++ b/src/CallTip.h @@ -72,7 +72,8 @@ public:  	/// Setup the calltip and return a rectangle of the area required.  	PRectangle CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn,  		const char *faceName, int size, int codePage_, -		int characterSet, int technology, const Window &wParent); +		int characterSet, int technology, const char *localeName, +		const Window &wParent);  	void CallTipCancel(); diff --git a/src/Editor.cxx b/src/Editor.cxx index 63ed979d9..208a075aa 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7199,6 +7199,16 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_GETELEMENTALLOWSTRANSLUCENT:  		return vs.ElementAllowsTranslucent(static_cast<int>(wParam)); +	case SCI_SETFONTLOCALE: +		if (lParam) { +			vs.SetFontLocaleName(CharPtrFromSPtr(lParam)); +			InvalidateStyleRedraw(); +		} +		break; + +	case SCI_GETFONTLOCALE: +		return StringResult(lParam, vs.localeName.c_str()); +  #ifdef INCLUDE_DEPRECATED_FEATURES  	case SCI_SETSTYLEBITS:  		vs.EnsureStyle(0xff); diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index e2fb58206..72bb5f6e0 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -478,6 +478,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) {  		CodePage(),  		vs.styles[ctStyle].characterSet,  		vs.technology, +		vs.localeName.c_str(),  		wMain);  	// If the call-tip window would be out of the client  	// space diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index f553f4205..aa6779728 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -42,14 +42,15 @@ FontRealised::FontRealised() noexcept = default;  FontRealised::~FontRealised() {  } -void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs) { +void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs, const char *localeName) {  	PLATFORM_ASSERT(fs.fontName);  	sizeZoomed = fs.size + zoomLevel * SC_FONT_SIZE_MULTIPLIER;  	if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER)	// Hangs if sizeZoomed <= 1  		sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER;  	const float deviceHeight = static_cast<float>(surface.DeviceHeightFont(sizeZoomed)); -	const FontParameters fp(fs.fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, fs.weight, fs.italic, fs.extraFontFlag, technology, fs.characterSet); +	const FontParameters fp(fs.fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, fs.weight, +		fs.italic, fs.extraFontFlag, technology, fs.characterSet, localeName);  	font = Font::Allocate(fp);  	ascent = static_cast<unsigned int>(surface.Ascent(font.get())); @@ -152,6 +153,8 @@ ViewStyle::ViewStyle(const ViewStyle &source) : markers(MARKER_MAX + 1), indicat  	wrapVisualFlagsLocation = source.wrapVisualFlagsLocation;  	wrapVisualStartIndent = source.wrapVisualStartIndent;  	wrapIndentMode = source.wrapIndentMode; + +	localeName = source.localeName;  }  ViewStyle::~ViewStyle() { @@ -286,6 +289,8 @@ void ViewStyle::Init(size_t stylesSize_) {  	wrapVisualFlagsLocation = 0;  	wrapVisualStartIndent = 0;  	wrapIndentMode = SC_WRAPINDENT_FIXED; + +	localeName = localeNameDefault;  }  void ViewStyle::Refresh(Surface &surface, int tabInChars) { @@ -307,7 +312,7 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) {  	// Ask platform to allocate each unique font.  	for (std::pair<const FontSpecification, std::unique_ptr<FontRealised>> &font : fonts) { -		font.second->Realise(surface, zoomLevel, technology, font.first); +		font.second->Realise(surface, zoomLevel, technology, font.first, localeName.c_str());  	}  	// Set the platform font handle and measurements for each style. @@ -400,6 +405,10 @@ void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {  	styles[styleIndex].fontName = fontNames.Save(name);  } +void ViewStyle::SetFontLocaleName(const char *name) { +	localeName = name; +} +  bool ViewStyle::ProtectionActive() const noexcept {  	return someStylesProtected;  } diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 7f50804c2..946bd6c60 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -37,7 +37,7 @@ public:  	FontRealised &operator=(const FontRealised &) = delete;  	FontRealised &operator=(FontRealised &&) = delete;  	virtual ~FontRealised(); -	void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs); +	void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs, const char *localeName);  };  enum class IndentView {none, real, lookForward, lookBoth}; @@ -168,6 +168,8 @@ public:  	int wrapVisualStartIndent;  	int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT +	std::string localeName; +  	ViewStyle();  	ViewStyle(const ViewStyle &source);  	ViewStyle(ViewStyle &&) = delete; @@ -184,6 +186,7 @@ public:  	void ResetDefaultStyle();  	void ClearStyles();  	void SetStyleFontName(int styleIndex, const char *name); +	void SetFontLocaleName(const char *name);  	bool ProtectionActive() const noexcept;  	int ExternalMarginWidth() const noexcept;  	int MarginFromLocation(Point pt) const noexcept; | 
