Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Gillibald committed Nov 6, 2019
1 parent 12e418b commit 86ff828
Show file tree
Hide file tree
Showing 17 changed files with 270 additions and 383 deletions.
1 change: 0 additions & 1 deletion samples/ControlCatalog/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<TabItem Header="TabControl"><pages:TabControlPage/></TabItem>
<TabItem Header="TabStrip"><pages:TabStripPage/></TabItem>
<TabItem Header="TextBox"><pages:TextBoxPage/></TabItem>
<TabItem Header="GlyphRun"><pages:GlyphRunPage/></TabItem>
<TabItem Header="ToolTip"><pages:ToolTipPage/></TabItem>
<TabItem Header="TreeView"><pages:TreeViewPage/></TabItem>
<TabItem Header="Viewbox"><pages:ViewboxPage/></TabItem>
Expand Down
6 changes: 0 additions & 6 deletions samples/ControlCatalog/Pages/GlyphRunPage.xaml

This file was deleted.

87 changes: 0 additions & 87 deletions samples/ControlCatalog/Pages/GlyphRunPage.xaml.cs

This file was deleted.

4 changes: 1 addition & 3 deletions src/Avalonia.Visuals/Media/FormattedTextStyleSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ namespace Avalonia.Media
/// </summary>
public class FormattedTextStyleSpan
{
private static readonly IFontManager s_fontManager = AvaloniaLocator.Current.GetService<IFontManager>();

/// <summary>
/// Initializes a new instance of the <see cref="FormattedTextStyleSpan"/> class.
/// </summary>
Expand Down Expand Up @@ -82,7 +80,7 @@ private static Typeface GetTypeface(FontFamily fontFamily, FontWeight? fontWeigh
fontStyle = FontStyle.Normal;
}

return s_fontManager.GetTypeface(fontFamily, fontWeight.Value, fontStyle.Value);
return FontManager.Default.GetCachedTypeface(fontFamily, fontWeight.Value, fontStyle.Value);
}
}
}
57 changes: 0 additions & 57 deletions src/Avalonia.Visuals/Platform/IFontManager.cs

This file was deleted.

91 changes: 0 additions & 91 deletions src/Skia/Avalonia.Skia/FontManager.cs

This file was deleted.

5 changes: 1 addition & 4 deletions src/Skia/Avalonia.Skia/TextRunIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
using Avalonia.Media;
using Avalonia.Media.Text;
using Avalonia.Media.Text.Unicode;
using Avalonia.Platform;
using HarfBuzzSharp;

namespace Avalonia.Skia
{
internal static class TextRunIterator
{
private static readonly IFontManager s_fontManager = AvaloniaLocator.Current.GetService<IFontManager>();

/// <summary>
/// Creates a list of text runs with unique properties.
/// </summary>
Expand All @@ -35,7 +32,7 @@ public static List<TextRunProperties> Create(ReadOnlySlice<char> text, Typeface

//ToDo: Fix FontFamily fallback
currentTypeface =
s_fontManager.MatchCharacter(codepoint, defaultTypeface.Weight, defaultTypeface.Style);
FontManager.Default.MatchCharacter(codepoint, defaultTypeface.Weight, defaultTypeface.Style);

if (currentTypeface == null || !TryGetRunProperties(text, currentTypeface, defaultTypeface, out count))
{
Expand Down
7 changes: 7 additions & 0 deletions src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Avalonia.Controls.Platform.Surfaces;
using Avalonia.Direct2D1.Media;
using Avalonia.Direct2D1.Media.Imaging;
using Avalonia.Media;
using Avalonia.Platform;
using SharpDX.DirectWrite;
using GlyphRun = Avalonia.Media.GlyphRun;
Expand All @@ -31,6 +32,7 @@ public class Direct2D1Platform : IPlatformRenderInterface
{
private readonly ConcurrentDictionary<Typeface, GlyphTypefaceImpl> _glyphTypefaceCache =
new ConcurrentDictionary<Typeface, GlyphTypefaceImpl>();

private static readonly Direct2D1Platform s_instance = new Direct2D1Platform();

public static SharpDX.Direct3D11.Device Direct3D11Device { get; private set; }
Expand Down Expand Up @@ -177,6 +179,11 @@ public IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, PixelSize size, V
return new WicBitmapImpl(format, data, size, dpi, stride);
}

public IGlyphTypefaceImpl CreateGlyphTypeface(Typeface typeface)
{
return _glyphTypefaceCache.GetOrAdd(typeface, new GlyphTypefaceImpl(typeface));
}

public IGlyphRunImpl CreateGlyphRun(GlyphRun glyphRun, out double width)
{
var glyphTypeface = (GlyphTypefaceImpl)glyphRun.GlyphTypeface.PlatformImpl;
Expand Down
Loading

0 comments on commit 86ff828

Please sign in to comment.