<commit_before>﻿//MIT, 2014-2016, WinterDev
using SkiaSharp;
namespace PixelFarm.Drawing.Skia
{
    partial class MySkiaCanvas
    {
        RequestFont currentTextFont = null;
        Color mycurrentTextColor = Color.Black;


        public override void DrawText(char[] buffer, int x, int y)
        {
            SKRect clipRect = currentClipRect;
            clipRect.Offset(canvasOriginX, canvasOriginY);
            //1.
            //skCanvas.ClipRect(clipRect);
            //2.
            skCanvas.DrawText(new string(buffer), x, y, textFill);
            ////3.
            //ClearCurrentClipRect();
        }
        public override void DrawText(char[] buffer, Rectangle logicalTextBox, int textAlignment)
        {
            SKRect clipRect = currentClipRect;
            //1.
            clipRect.Offset(canvasOriginX, canvasOriginY);
            //2.
            //skCanvas.ClipRect(clipRect);
            //3.
            //TODO: review here
            skCanvas.DrawText(new string(buffer),
                logicalTextBox.X,
                logicalTextBox.Bottom,
                textFill);
            //4. 
            //ClearCurrentClipRect();
        }
        public override void DrawText(char[] str, int startAt, int len, Rectangle logicalTextBox, int textAlignment)
        {
            //this is the most common used function for text drawing
            //return;
#if DEBUG
            dbugDrawStringCount++;
#endif
            var color = this.CurrentTextColor;
            if (color.A == 255)
            {
                //1. find clip rect
                var clipRect = Rectangle.Intersect(logicalTextBox,
                    new Rectangle((int)currentClipRect.Left,
                        (int)currentClipRect.Top,
                        (int)currentClipRect.Width,
                        (int)currentClipRect.Height));
                //2. offset to canvas origin 
                clipRect.Offset(canvasOriginX, canvasOriginY);
                //3. set rect rgn  
                // skCanvas.ClipRect(new SKRect(clipRect.Left, clipRect.Top, clipRect.Right, clipRect.Bottom));
                //4.
                skCanvas.DrawText(new string(str, startAt, len),
                    logicalTextBox.X,
                    logicalTextBox.Bottom,
                    textFill);
                //5. clear 
                //ClearCurrentClipRect();
#if DEBUG
                //NativeTextWin32.dbugDrawTextOrigin(tempDc,
                //        logicalTextBox.X + canvasOriginX,
                //        logicalTextBox.Y + canvasOriginY);
#endif

            }
            else
            {

                //1. find clip rect
                var clipRect = Rectangle.Intersect(logicalTextBox,
                    new Rectangle((int)currentClipRect.Left,
                        (int)currentClipRect.Top,
                        (int)currentClipRect.Width,
                        (int)currentClipRect.Height));
                //2. offset to canvas origin 
                clipRect.Offset(canvasOriginX, canvasOriginY);
                //3. set rect rgn  
                skCanvas.ClipRect(new SKRect(clipRect.Left, clipRect.Top, clipRect.Right, clipRect.Bottom));
                //4.
                skCanvas.DrawText(new string(str, startAt, len),
                    logicalTextBox.X,
                    logicalTextBox.Bottom,
                    textFill);
                //5. clear 
                //ClearCurrentClipRect();

#if DEBUG
                //NativeTextWin32.dbugDrawTextOrigin(tempDc,
                //        logicalTextBox.X + canvasOriginX,
                //        logicalTextBox.Y + canvasOriginY);
#endif
            }
        }
        //====================================================
        public override RequestFont CurrentFont
        {
            get
            {
                return currentTextFont;
            }
            set
            {
                this.currentTextFont = value;
                //resolve font
#if DEBUG
#endif

                SKTypeface typeFace = SkiaGraphicsPlatform.GetInstalledFont(value.Name);
                if (typeFace != null)
                {
                    textFill.Typeface = typeFace;
                    textFill.TextSize = value.SizeInPoints;
                }
                //textFill.TextSize = value.SizeInPoints;                 
            }
        }
        public override Color CurrentTextColor
        {
            get
            {
                return mycurrentTextColor;
            }
            set
            {
                textFill.Color = Conv1.ConvToColor(mycurrentTextColor = value);
            }
        }
    }
}<commit_msg>1263: textFill's AutoHinted and LcdRenderText<commit_after>﻿//MIT, 2014-2016, WinterDev
using SkiaSharp;
namespace PixelFarm.Drawing.Skia
{
    partial class MySkiaCanvas
    {
        RequestFont currentTextFont = null;
        Color mycurrentTextColor = Color.Black;


        public override void DrawText(char[] buffer, int x, int y)
        {
            SKRect clipRect = currentClipRect;
            clipRect.Offset(canvasOriginX, canvasOriginY);
            //1.
            //skCanvas.ClipRect(clipRect);
            //2.
            skCanvas.DrawText(new string(buffer), x, y, textFill);
            ////3.
            //ClearCurrentClipRect();
        }
        public override void DrawText(char[] buffer, Rectangle logicalTextBox, int textAlignment)
        {
            SKRect clipRect = currentClipRect;
            //1.
            clipRect.Offset(canvasOriginX, canvasOriginY);
            //2.
            //skCanvas.ClipRect(clipRect);
            //3.
            //TODO: review here
            skCanvas.DrawText(new string(buffer),
                logicalTextBox.X,
                logicalTextBox.Bottom,
                textFill);
            //4. 
            //ClearCurrentClipRect();
        }
        public override void DrawText(char[] str, int startAt, int len, Rectangle logicalTextBox, int textAlignment)
        {
            //this is the most common used function for text drawing
            //return;
#if DEBUG
            dbugDrawStringCount++;
#endif
            var color = this.CurrentTextColor;
            if (color.A == 255)
            {
                //1. find clip rect
                var clipRect = Rectangle.Intersect(logicalTextBox,
                    new Rectangle((int)currentClipRect.Left,
                        (int)currentClipRect.Top,
                        (int)currentClipRect.Width,
                        (int)currentClipRect.Height));
                //2. offset to canvas origin 
                clipRect.Offset(canvasOriginX, canvasOriginY);
                //3. set rect rgn  
                // skCanvas.ClipRect(new SKRect(clipRect.Left, clipRect.Top, clipRect.Right, clipRect.Bottom));
                //4.
                skCanvas.DrawText(new string(str, startAt, len),
                    logicalTextBox.X,
                    logicalTextBox.Bottom,
                    textFill);
                //5. clear 
                //ClearCurrentClipRect();
#if DEBUG
                //NativeTextWin32.dbugDrawTextOrigin(tempDc,
                //        logicalTextBox.X + canvasOriginX,
                //        logicalTextBox.Y + canvasOriginY);
#endif

            }
            else
            {

                //1. find clip rect
                var clipRect = Rectangle.Intersect(logicalTextBox,
                    new Rectangle((int)currentClipRect.Left,
                        (int)currentClipRect.Top,
                        (int)currentClipRect.Width,
                        (int)currentClipRect.Height));
                //2. offset to canvas origin 
                clipRect.Offset(canvasOriginX, canvasOriginY);
                //3. set rect rgn  
                skCanvas.ClipRect(new SKRect(clipRect.Left, clipRect.Top, clipRect.Right, clipRect.Bottom));
                //4.
                skCanvas.DrawText(new string(str, startAt, len),
                    logicalTextBox.X,
                    logicalTextBox.Bottom,
                    textFill);
                //5. clear 
                //ClearCurrentClipRect();

#if DEBUG
                //NativeTextWin32.dbugDrawTextOrigin(tempDc,
                //        logicalTextBox.X + canvasOriginX,
                //        logicalTextBox.Y + canvasOriginY);
#endif
            }
        }
        //====================================================
        public override RequestFont CurrentFont
        {
            get
            {
                return currentTextFont;
            }
            set
            {
                this.currentTextFont = value;
                //resolve font
#if DEBUG
#endif

                SKTypeface typeFace = SkiaGraphicsPlatform.GetInstalledFont(value.Name);
                if (typeFace != null)
                {
                    textFill.Typeface = typeFace;
                    textFill.TextSize = value.SizeInPoints;
                    textFill.IsAutohinted = true;
                    textFill.LcdRenderText = true;
                }
                //textFill.TextSize = value.SizeInPoints;                 
            }
        }
        public override Color CurrentTextColor
        {
            get
            {
                return mycurrentTextColor;
            }
            set
            {
                textFill.Color = Conv1.ConvToColor(mycurrentTextColor = value);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.09402875432889075, 'fraction_numerical': 0.00734599643194459, 'mean_word_length': 1.237614463489082, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1120442', 'n_tokens_mistral': 2431, 'n_tokens_neox': 2276, 'n_words': 478}