These are chat archives for AvaloniaUI/Avalonia

28th
May 2018
Rayyan Tahir
@RayyanTahir
May 28 2018 08:05

@RayyanTahir are custom fonts now working for you? and which rendering backend are you using?

@danwalmsley On the latest nightly build, my custom fonts work if FontFamily property is added directly to the control. It doesn't appear if I add it as a style. I'm testing on Windows

danwalmsley
@danwalmsley
May 28 2018 08:06
@RayyanTahir that is working for me
Rayyan Tahir
@RayyanTahir
May 28 2018 08:06
I'll try to make a repro of it.
@danwalmsley please check if the icon is rendering at your end
Rayyan Tahir
@RayyanTahir
May 28 2018 08:13
@danwalmsley try this one CustomFontRepro.zip
Steven Kirk
@grokys
May 28 2018 08:22
@danwalmsley AvaloniaUI/Avalonia#1624
Benedikt Schroeder
@Gillibald
May 28 2018 08:24
Have to figure out how to setup a working dev environment under Linux. That will take a bit then i can start to debug custom fonts.
danwalmsley
@danwalmsley
May 28 2018 08:25
@RayyanTahir ok I have a diagnosis
you need to put your style inside Window.Styles
not Window.Resourses
so like this
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="CustomFontRepro" Width="200" Height="200">
    <Window.Styles>
        <Style Selector="TextBlock.Icons">
            <Setter Property="FontFamily" Value="resm:CustomFontRepro.Assets?assembly=CustomFontRepro#swap-custom-icon"/>
        </Style>
    </Window.Styles>
    <Grid>
        <TextBlock Name="txt" Classes="Icons" Text="a" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50" />
    </Grid>
</Window>
and if you want to use resources it would be consumed differently
like this
Rayyan Tahir
@RayyanTahir
May 28 2018 08:27
That fixed it. Thanks :smile:
danwalmsley
@danwalmsley
May 28 2018 08:27
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="CustomFontRepro" Width="200" Height="200">
  <Window.Resources>
        <FontFamily x:Key="IconFont">resm:CustomFontRepro.Assets?assembly=CustomFontRepro#swap-custom-icon</FontFamily>
    </Window.Resources>
  <Grid>
    <TextBlock Name="txt" Classes="Icons" Text="a" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="{StaticResource IconFont}"  FontSize="50"/>
  </Grid>
</Window>
note the difference between resources and styles
Styles are applied to the tree via selectors
Resources is like defining a kind of global variable that is accessible
Rayyan Tahir
@RayyanTahir
May 28 2018 08:29
Got it
danwalmsley
@danwalmsley
May 28 2018 08:29
@grokys just testing now
danwalmsley
@danwalmsley
May 28 2018 08:57
@grokys merged, thanks for fix
Rayyan Tahir
@RayyanTahir
May 28 2018 09:15
@danwalmsley I found another issue, My EnumToTextConverter is not being called when used in XAML. I have a repro:
danwalmsley
@danwalmsley
May 28 2018 09:25
@RayyanTahir I cant see you setting datacontext anywhere
so nothing to convert?
Text would be Unset
Rayyan Tahir
@RayyanTahir
May 28 2018 09:25
I'm trying to pass a static value using x:Static
danwalmsley
@danwalmsley
May 28 2018 09:27
@RayyanTahir if you add
DataContext = FontIcons.AnnotateIcon;
it works
your code will work
as long as there is a datacontext
DataContext = "";
also makes it work
you need something to call the converter
Rayyan Tahir
@RayyanTahir
May 28 2018 09:28
That worked. thanks a bunch :+1:
danwalmsley
@danwalmsley
May 28 2018 09:29
<TextBlock Name="txt" Classes="Icons" DataContext=""
also works
which might be better to keep it all in xaml
I guess chances are there will be a datacontext anyway
Rayyan Tahir
@RayyanTahir
May 28 2018 09:30
Yeah, I am using datacontexts but wasn't passing the icons's enum in the contexts
But, DataContext="" really did do the trick, it triggered the converter
Benedikt Schroeder
@Gillibald
May 28 2018 11:29
With the help of @jmacato we know the cause of non working custom fonts under Linux. It seems that it is caused by a bug in skia that should be fixed with current bins.
Our nuget package is quiet old. Have to verify if the current release fixes the problem.
Splitwirez
@Splitwirez
May 28 2018 12:56
Question...on Windows, will Avalonia's future default styles be assigned by version, or by Visual Style?
Benedikt Schroeder
@Gillibald
May 28 2018 14:43
Didnt realise that SkiaSharp uses xamarins fork of skia. I wonder if all fixes of the master get merged in time.
Wiesław Šoltés
@wieslawsoltes
May 28 2018 16:45
Making some nice progress with Avalonia docking control.
Nelson Carrillo
@nc4rrillo
May 28 2018 16:50
Looks slick! @wieslawsoltes
dragging a docked control from one window to another is sweet
Wiesław Šoltés
@wieslawsoltes
May 28 2018 16:51
More to come @danwalmsley is working in Xaml to make it much nicer
Jumar Macato
@jmacato
May 28 2018 16:53
@wieslawsoltes only one stone throw away from being as flexible as VS :laughing:
super awesome progress :smile:
Wiesław Šoltés
@wieslawsoltes
May 28 2018 16:53
it will be better :fire:
Jumar Macato
@jmacato
May 28 2018 16:53
indeed :smile:
Wiesław Šoltés
@wieslawsoltes
May 28 2018 16:54
Its different philosophy
All is defined is code
at least for now
Jumar Macato
@jmacato
May 28 2018 16:56
When that is integrated in AS, it'd be so glorious