rebeccaXam / XamForms.Controls.Calendar

Custom calendar control for Xamarin.Forms. Customizable border thickness, color, background colors and formats. Version 1.0.8 or lower Built against: 2.1.0.6521 Version 1.1.0 or above Built against: 2.3.4.231
MIT License
132 stars 69 forks source link

special days text in calendar is very blurred #92

Closed ufukhawk closed 3 years ago

ufukhawk commented 5 years ago

The text that I added to the special days in the calendar appears to be extremely blurred when working in ios mode, there is no error in Android mode. untitled

ufukhawk commented 5 years ago

there is no answer to this question?

lubiepomaranczki commented 5 years ago

What platform is that? Which device?

ufukhawk commented 5 years ago

Platform is iOS. All iOS device.

lubiepomaranczki commented 5 years ago

I will take a look over the weekend if you want. Otherwise, you can try checking the code on your own. I don't suppose Rebeca will appear & help you :-(

ufukhawk commented 5 years ago

My iOS renderer Code. ' protected void DrawText(CGContext g, Pattern p, CGRect r) { if (string.IsNullOrEmpty(p.Text)) return;//Copperplate-Light" KohinoorTelugu-Light string fontname = Device.Idiom == TargetIdiom.Tablet ? "Helvetica" : "GillSans-UltraBold";//GillSans-UltraBold var bounds = p.Text.StringSize(UIFont.FromName(fontname, p.TextSize)); //"GillSans-UltraBold var al = (int)p.TextAlign; var x = r.X; if ((al & 2) == 2) // center { x = r.X + (int)Math.Round(r.Width / 2.0) - (int)Math.Round(bounds.Width / 2.0); } else if ((al & 4) == 4) // right { x = (r.X + r.Width) - bounds.Width - 2; } var y = r.Y + (int)Math.Round(bounds.Height / 2.0) + 2; if ((al & 16) == 16) // middle { y = r.Y + (int)Math.Ceiling(r.Height / 2.0) + (int)Math.Round(bounds.Height / 5.0); } else if ((al & 32) == 32) // bottom { y = (r.Y + r.Height) - 2; }

        g.SaveState();
        g.SetAllowsFontSmoothing(true);
        g.SetAllowsFontSubpixelQuantization(true);
        g.SetAllowsAntialiasing(true);
        g.SetShouldSmoothFonts(true);
        g.SetShouldAntialias(true);
        g.InterpolationQuality = CGInterpolationQuality.High;

        g.SetShouldSubpixelPositionFonts(true);
        g.SetAllowsSubpixelPositioning(true);
        g.SetLineCap(CGLineCap.Square);

        g.SetFlatness(1f);

        g.TranslateCTM(0, Bounds.Height);
        g.ScaleCTM(1, -1);
        g.SetStrokeColor(p.TextColor.ToCGColor());
        g.DrawPath(CGPathDrawingMode.EOFillStroke);
        g.SetFillColor(p.TextColor.ToCGColor());
        g.SetTextDrawingMode(CGTextDrawingMode.FillStroke);
        g.SelectFont(fontname, p.TextSize, CGTextEncoding.MacRoman);
        g.ShowTextAtPoint(x, Bounds.Height - y, p.Text,p.Text.Length);
        g.RestoreState();
    }
}'
ufukhawk commented 5 years ago

@lubiepomaranczki okay, thanks :(

lubiepomaranczki commented 5 years ago

can you make a sample repo with this issue?