This commit is contained in:
Lluis Sanchez 2013-03-28 18:42:54 +01:00
Родитель b750c315d9
Коммит 50d96a35c8
4 изменённых файлов: 19 добавлений и 16 удалений

Просмотреть файл

@ -44,8 +44,8 @@ namespace Xwt
public void WithFamily ()
{
var f1 = Font.SystemFont;
var f2 = f1.WithFamily ("Courier");
Assert.AreEqual ("Courier", f2.Family);
var f2 = f1.WithFamily ("Arial");
Assert.AreEqual ("Arial", f2.Family);
Assert.AreEqual (f1.Size, f2.Size);
Assert.AreEqual (f1.Stretch, f2.Stretch);
Assert.AreEqual (f1.Style, f2.Style);

Просмотреть файл

@ -245,10 +245,6 @@ namespace Xwt.WPFBackend
c.SetPattern ((System.Windows.Media.Brush)p);
}
public override void SetFont (object backend, Font font)
{
}
public override void DrawTextLayout (object backend, TextLayout layout, double x, double y)
{
var c = (DrawingContext) backend;

Просмотреть файл

@ -26,6 +26,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Linq;
using SW = System.Windows;
using Xwt.Backends;
@ -37,6 +38,21 @@ namespace Xwt.WPFBackend
{
public class WpfFontBackendHandler : FontBackendHandler
{
public override object GetSystemDefaultFont ()
{
double size = WpfFontBackendHandler.GetPointsFromDeviceUnits (SW.SystemFonts.MessageFontSize);
return new FontData (SW.SystemFonts.MessageFontFamily, size) {
Style = SW.SystemFonts.MessageFontStyle,
Weight = SW.SystemFonts.MessageFontWeight
};
}
public override System.Collections.Generic.IEnumerable<string> GetInstalledFonts ()
{
return System.Windows.Media.Fonts.SystemFontFamilies.Select (f => f.Source);
}
public override object Create (string fontName, double size, FontStyle style, FontWeight weight, FontStretch stretch)
{
return new FontData (new FontFamily (fontName), size) {

Просмотреть файл

@ -38,17 +38,8 @@ namespace Xwt.WPFBackend
public class WpfTextLayoutBackendHandler
: TextLayoutBackendHandler
{
public override object Create (Context context)
public override object Create ()
{
var drawingContext = (DrawingContext)Toolkit.GetBackend (context);
return new TextLayoutBackend () {
Context = drawingContext
};
}
public override object Create (ICanvasBackend canvas)
{
var backend = (WidgetBackend)canvas;
return new TextLayoutBackend ();
}