]> O.S.I.I.S - jp/crow.git/commitdiff
Removed Utf16->Utf8 conversion on Win os, so Mono framework, which use
authorJP Bruyère <jp_bruyere@hotmail.com>
Sun, 24 Jul 2016 03:51:46 +0000 (05:51 +0200)
committerJP Bruyère <jp_bruyere@hotmail.com>
Sun, 24 Jul 2016 03:51:46 +0000 (05:51 +0200)
Utf8 for string encoding on every os becomes mandatory.
modified:   src/GraphicObjects/Label.cs
modified:   src/GraphicObjects/TextRun.cs

src/GraphicObjects/Label.cs
src/GraphicObjects/TextRun.cs

index 22a60aa0e6e83e1476f8e69e33b54df9d3439b81..6831a9cca22d5dd9d91bc68a7ff97be650a255f2 100644 (file)
@@ -364,11 +364,8 @@ namespace Crow
                                        foreach (string s in lines) {
                                                string l = s.Replace("\t", new String (' ', Interface.TabSize));
 
-#if _WIN32 || _WIN64
-                                               TextExtents tmp = gr.TextExtents(str.ToUtf8());
-#elif __linux__
                                                TextExtents tmp = gr.TextExtents (l);
-#endif
+
                                                if (tmp.XAdvance > te.XAdvance)
                                                        te = tmp;
                                        }
@@ -562,12 +559,7 @@ namespace Crow
 
                                Foreground.SetAsSource (gr);    
                                gr.MoveTo (lineRect.X, rText.Y + fe.Ascent + fe.Height * i);
-
-                               #if _WIN32 || _WIN64
-                               gr.ShowText(l.ToUtf8());
-                               #elif __linux__
                                gr.ShowText (l);
-                               #endif
                                gr.Fill ();
                        }
                }
@@ -656,12 +648,8 @@ namespace Crow
                                if (c == "\t")
                                        c = new string (' ', Interface.TabSize);
                                
-                               #if _WIN32 || _WIN64
-                               byte[] c = System.Text.UTF8Encoding.UTF8.GetBytes(Text.Substring(i, 1));
                                te = gr.TextExtents(c);
-                               #elif __linux__
-                               te = gr.TextExtents(c);
-                               #endif
+
                                double halfWidth = te.XAdvance / 2;
 
                                if (mouseLocalPos.X <= cPos + halfWidth)
index 103f2fcf73a044403fa500052753b854e7860e91..6af22025b8181d45f5234b26333ee2f057670944 100644 (file)
@@ -155,12 +155,7 @@ namespace Crow
 
                                        foreach (string s in lines) {
                                                string l = s.Replace("\t", new String (' ', Interface.TabSize));
-
-                                               #if _WIN32 || _WIN64
-                                               TextExtents tmp = gr.TextExtents(str.ToUtf8());
-                                               #elif __linux__
                                                TextExtents tmp = gr.TextExtents (l);
-                                               #endif
                                                if (tmp.XAdvance > te.XAdvance)
                                                        te = tmp;
                                        }
@@ -287,15 +282,10 @@ namespace Crow
                                        Foreground.SetAsSource (gr);    
                                        gr.MoveTo (rText.X, rText.Y + fe.Ascent + fe.Height * curLineCount);
 
-                                       #if _WIN32 || _WIN64
-                                       gr.ShowText(ll.ToUtf8());
-                                       #elif __linux__
                                        gr.ShowText (ll);
-                                       #endif
                                        gr.Fill ();
 
                                        curLineCount++;
-                                               
                                }
                        }                                               
                }