зеркало из https://github.com/mono/SkiaSharp.git
Added a sample to show text shaping
This commit is contained in:
Родитель
176cf41116
Коммит
f47fe03e06
|
@ -132,6 +132,12 @@
|
|||
<HintPath>..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="HarfBuzzSharp">
|
||||
<HintPath>..\packages\HarfBuzzSharp.1.4.5\lib\MonoAndroid\HarfBuzzSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.HarfBuzz">
|
||||
<HintPath>..\packages\SkiaSharp.Harfbuzz.1.57.1-beta\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.HarfBuzz.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="HarfBuzzSharp" version="1.4.5" targetFramework="monoandroid60" />
|
||||
<package id="PCLStorage" version="1.0.2" targetFramework="monoandroid60" />
|
||||
<package id="SkiaSharp" version="1.57.1" targetFramework="monoandroid60" />
|
||||
<package id="SkiaSharp.Harfbuzz" version="1.57.1-beta" targetFramework="monoandroid60" />
|
||||
<package id="SkiaSharp.Svg" version="1.57.1" targetFramework="monoandroid60" />
|
||||
<package id="SkiaSharp.Views" version="1.57.1" targetFramework="monoandroid60" />
|
||||
<package id="SkiaSharp.Views.Forms" version="1.57.1" targetFramework="monoandroid60" />
|
||||
|
|
|
@ -97,6 +97,12 @@
|
|||
<HintPath>..\packages\Xamarin.Forms.2.3.4.231\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="HarfBuzzSharp">
|
||||
<HintPath>..\packages\HarfBuzzSharp.1.4.5\lib\portable-net45+win8+wpa81+wp8\HarfBuzzSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.HarfBuzz">
|
||||
<HintPath>..\packages\SkiaSharp.Harfbuzz.1.57.1-beta\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.HarfBuzz.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="DetailContentsPage.xaml">
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="HarfBuzzSharp" version="1.4.5" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
<package id="PCLStorage" version="1.0.2" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
<package id="SkiaSharp" version="1.57.1" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
<package id="SkiaSharp.Harfbuzz" version="1.57.1-beta" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
<package id="SkiaSharp.Svg" version="1.57.1" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
<package id="SkiaSharp.Views.Forms" version="1.57.1" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
<package id="Xamarin.Forms" version="2.3.4.231" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
|
|
|
@ -75,10 +75,16 @@
|
|||
<HintPath>..\packages\SkiaSharp.Views.Forms.1.57.1\lib\XamarinMac\SkiaSharp.Views.Forms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.Svg">
|
||||
<HintPath>..\packages\SkiaSharp.Svg.1.57.1\lib\netstandard1.3\SkiaSharp.Svg.dll</HintPath>
|
||||
<HintPath>..\packages\SkiaSharp.Svg.1.57.1\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.Svg.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.Extended">
|
||||
<HintPath>..\packages\SkiaSharp.Extended.1.57.1-beta\lib\netstandard1.3\SkiaSharp.Extended.dll</HintPath>
|
||||
<HintPath>..\packages\SkiaSharp.Extended.1.57.1-beta\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.Extended.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HarfBuzzSharp">
|
||||
<HintPath>..\packages\HarfBuzzSharp.1.4.5\lib\XamarinMac\HarfBuzzSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.HarfBuzz">
|
||||
<HintPath>..\packages\SkiaSharp.Harfbuzz.1.57.1-beta\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.HarfBuzz.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -128,4 +134,5 @@
|
|||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
|
||||
<Import Project="..\packages\Xamarin.Forms.2.3.5.233-pre1\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.5.233-pre1\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
|
||||
<Import Project="..\packages\SkiaSharp.1.57.1\build\XamarinMac\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.1.57.1\build\XamarinMac\SkiaSharp.targets')" />
|
||||
<Import Project="..\packages\HarfBuzzSharp.1.4.5\build\XamarinMac\HarfBuzzSharp.targets" Condition="Exists('..\packages\HarfBuzzSharp.1.4.5\build\XamarinMac\HarfBuzzSharp.targets')" />
|
||||
</Project>
|
|
@ -1,7 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="HarfBuzzSharp" version="1.4.5" targetFramework="xamarinmac20" />
|
||||
<package id="SkiaSharp" version="1.57.1" targetFramework="xamarinmac20" />
|
||||
<package id="SkiaSharp.Extended" version="1.57.1-beta" targetFramework="xamarinmac20" />
|
||||
<package id="SkiaSharp.Harfbuzz" version="1.57.1-beta" targetFramework="xamarinmac20" />
|
||||
<package id="SkiaSharp.Svg" version="1.57.1" targetFramework="xamarinmac20" />
|
||||
<package id="SkiaSharp.Views" version="1.57.1" targetFramework="xamarinmac20" />
|
||||
<package id="SkiaSharp.Views.Forms" version="1.57.1" targetFramework="xamarinmac20" />
|
||||
|
|
|
@ -180,6 +180,12 @@
|
|||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
<Reference Include="HarfBuzzSharp">
|
||||
<HintPath>..\packages\HarfBuzzSharp.1.4.5\lib\XamariniOS\HarfBuzzSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.HarfBuzz">
|
||||
<HintPath>..\packages\SkiaSharp.Harfbuzz.1.57.1-beta\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.HarfBuzz.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Core\Core.csproj">
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="HarfBuzzSharp" version="1.4.5" targetFramework="xamarinios10" />
|
||||
<package id="PCLStorage" version="1.0.2" targetFramework="xamarinios10" />
|
||||
<package id="SkiaSharp" version="1.57.1" targetFramework="xamarinios10" />
|
||||
<package id="SkiaSharp.Harfbuzz" version="1.57.1-beta" targetFramework="xamarinios10" />
|
||||
<package id="SkiaSharp.Svg" version="1.57.1" targetFramework="xamarinios10" />
|
||||
<package id="SkiaSharp.Views" version="1.57.1" targetFramework="xamarinios10" />
|
||||
<package id="SkiaSharp.Views.Forms" version="1.57.1" targetFramework="xamarinios10" />
|
||||
|
|
|
@ -59,6 +59,12 @@
|
|||
<Reference Include="SkiaSharp.Views.Mac">
|
||||
<HintPath>..\packages\SkiaSharp.Views.1.57.1\lib\XamarinMac\SkiaSharp.Views.Mac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HarfBuzzSharp">
|
||||
<HintPath>..\packages\HarfBuzzSharp.1.4.5\lib\XamarinMac\HarfBuzzSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.HarfBuzz">
|
||||
<HintPath>..\packages\SkiaSharp.Harfbuzz.1.57.1-beta\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.HarfBuzz.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
|
||||
|
@ -100,4 +106,5 @@
|
|||
<Import Project="..\..\SkiaSharpSample.Platform.Shared\SkiaSharpSample.Platform.Shared.projitems" Label="Shared" Condition="Exists('..\..\SkiaSharpSample.Platform.Shared\SkiaSharpSample.Platform.Shared.projitems')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
|
||||
<Import Project="..\packages\SkiaSharp.1.57.1\build\XamarinMac\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.1.57.1\build\XamarinMac\SkiaSharp.targets')" />
|
||||
<Import Project="..\packages\HarfBuzzSharp.1.4.5\build\XamarinMac\HarfBuzzSharp.targets" Condition="Exists('..\packages\HarfBuzzSharp.1.4.5\build\XamarinMac\HarfBuzzSharp.targets')" />
|
||||
</Project>
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="HarfBuzzSharp" version="1.4.5" targetFramework="xamarinmac20" />
|
||||
<package id="SkiaSharp" version="1.57.1" targetFramework="xamarinmac20" />
|
||||
<package id="SkiaSharp.Harfbuzz" version="1.57.1-beta" targetFramework="xamarinmac20" />
|
||||
<package id="SkiaSharp.Svg" version="1.57.1" targetFramework="xamarinmac20" />
|
||||
<package id="SkiaSharp.Views" version="1.57.1" targetFramework="xamarinmac20" />
|
||||
</packages>
|
|
@ -0,0 +1,39 @@
|
|||
using SkiaSharp;
|
||||
using SkiaSharp.HarfBuzz;
|
||||
|
||||
namespace SkiaSharpSample.Samples
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
public class TextShapingSample : SampleBase
|
||||
{
|
||||
[Preserve]
|
||||
public TextShapingSample()
|
||||
{
|
||||
}
|
||||
|
||||
public override string Title => "Text Shaping";
|
||||
|
||||
public override SampleCategories Category => SampleCategories.Text;
|
||||
|
||||
protected override void OnDrawSample(SKCanvas canvas, int width, int height)
|
||||
{
|
||||
canvas.DrawColor(SKColors.White);
|
||||
|
||||
using (var tf = SKFontManager.Default.MatchCharacter('م'))
|
||||
using (var paint = new SKPaint { IsAntialias = true, TextSize = 64 })
|
||||
using (var arabicPaint = new SKPaint { IsAntialias = true, TextSize = 64, Typeface = tf })
|
||||
{
|
||||
// unshaped
|
||||
canvas.DrawText("Unshaped:", 100, 100, paint);
|
||||
canvas.DrawText("مرحبا بالعالم", 100, 180, arabicPaint);
|
||||
|
||||
// shaped
|
||||
using (var shaper = new SKShaper(tf))
|
||||
{
|
||||
canvas.DrawText("Shaped:", 100, 300, paint);
|
||||
canvas.DrawShapedText(shaper, "مرحبا بالعالم", 100, 380, arabicPaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -59,6 +59,7 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)Samples\ColorTableColorFilterSample.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Samples\PathEffect2DPathSample.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Samples\SvgTransparencySample.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Samples\TextShapingSample.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Media\adobe-dng.dng" />
|
||||
|
|
|
@ -102,6 +102,12 @@
|
|||
<Reference Include="SkiaSharp.Views.tvOS">
|
||||
<HintPath>..\packages\SkiaSharp.Views.1.57.1\lib\XamarintvOS\SkiaSharp.Views.tvOS.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HarfBuzzSharp">
|
||||
<HintPath>..\packages\HarfBuzzSharp.1.4.5\lib\XamarintvOS\HarfBuzzSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.HarfBuzz">
|
||||
<HintPath>..\packages\SkiaSharp.Harfbuzz.1.57.1-beta\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.HarfBuzz.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\Contents.json" />
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="HarfBuzzSharp" version="1.4.5" targetFramework="xamarintvos10" />
|
||||
<package id="SkiaSharp" version="1.57.1" targetFramework="xamarintvos10" />
|
||||
<package id="SkiaSharp.Harfbuzz" version="1.57.1-beta" targetFramework="xamarintvos10" />
|
||||
<package id="SkiaSharp.Svg" version="1.57.1" targetFramework="xamarintvos10" />
|
||||
<package id="SkiaSharp.Views" version="1.57.1" targetFramework="xamarintvos10" />
|
||||
</packages>
|
Загрузка…
Ссылка в новой задаче