These are chat archives for AvaloniaUI/Avalonia

30th
Dec 2018
Kermalis
@Kermalis
Dec 30 2018 03:28 UTC
what's the equivalent of UpdateSourceTrigger?
Kermalis
@Kermalis
Dec 30 2018 03:35 UTC
better question, how do I know when something changed from the ui thread, like IsPointerOver for example
ahopper
@ahopper
Dec 30 2018 08:46 UTC
you can use styles and pseudoclasses like :pointerover for things like this. See http://avaloniaui.net/docs/styles/styles
ksigne
@ksigne
Dec 30 2018 19:16 UTC
hi everyone! started to experiment with Avalonia once again
I was missing horizontal letter spacing feature to get nice fonts
so I've added following to forked d2d:
var layout = TextLayout.QueryInterface<DWrite.TextLayout1>(); layout.SetCharacterSpacing((float)(2*typeface.HorizontalSpacing - 2), 0, 0, new DWrite.TextRange(0, Text.Length));
as far as I found there is no direct alternative of that in skia
any plans on making custom text renderers?
ksigne
@ksigne
Dec 30 2018 19:19 UTC
I've looked into this, but it is different stuff
it is focused on line-height only
Nikita Tsukanov
@kekekeks
Dec 30 2018 19:20 UTC
There is no built-in layout engine in Skia
ksigne
@ksigne
Dec 30 2018 19:20 UTC
yes, I know
i mean go deeper and position glyphs manually
you can do that in skia using SKCanvas.DrawPositionedText
ahopper
@ahopper
Dec 30 2018 19:21 UTC
there was talk of implementing wpf GlyphRun which I think allows this
ksigne
@ksigne
Dec 30 2018 19:22 UTC
skia doesn't have glyphrun
so basically i'm able to set letter spacing using TextLayout1 in SharpDX
it works
but it doesn't in skia
textlayout1 doesn't work in W7 without SP1, but who cares
ahopper
@ahopper
Dec 30 2018 19:23 UTC
35% of windows users :)
sorry forgot the sp1
Nikita Tsukanov
@kekekeks
Dec 30 2018 19:24 UTC
We require platform update anyway
ksigne
@ksigne
Dec 30 2018 19:24 UTC
image.png
ksigne
@ksigne
Dec 30 2018 19:24 UTC
image.png
Nikita Tsukanov
@kekekeks
Dec 30 2018 19:24 UTC
this one
ksigne
@ksigne
Dec 30 2018 19:25 UTC
so i'm confused is there any value in exploiting platform typesetting features
instead of reimplementing them in managed code
if skia is so limited
ahopper
@ahopper
Dec 30 2018 19:27 UTC
@Gillibald mentioned GlyphRun was on his todo list for skia
ksigne
@ksigne
Dec 30 2018 19:27 UTC
there is no glyphrun in skiasharp afaik
you can do DrawPositionedText but it is not glyphrun
technically you can draw FormattedText many times which is almost same, but slower
ahopper
@ahopper
Dec 30 2018 19:28 UTC
no idea what his plan was but maybe that was it
ksigne
@ksigne
Dec 30 2018 19:28 UTC
positioning each letter separately... skia doesn't provide raw font data
ahopper
@ahopper
Dec 30 2018 19:38 UTC
ForNeVeR/wpf-math#170 effectively does just that with external font info, this is ported from wpf but it did the same there, I'm intrigued to see if it can be done in a simpler way
ksigne
@ksigne
Dec 30 2018 19:47 UTC
oh wow
some really exciting stuff there
any screenshots how it looks in Avalonia?
Benedikt Stebner
@Gillibald
Dec 30 2018 19:50 UTC
Vertical and horizontal spacing will be no issue to implement
ksigne
@ksigne
Dec 30 2018 19:50 UTC
how would you implement horizontal spacing?
Benedikt Stebner
@Gillibald
Dec 30 2018 19:51 UTC
Just override the fonts default line spacing. Either by a factor or a fixed value.
ksigne
@ksigne
Dec 30 2018 19:52 UTC
what do you mean on line spacing here? i speak about letter spacing
ahopper
@ahopper
Dec 30 2018 19:52 UTC
image.png
ksigne
@ksigne
Dec 30 2018 19:53 UTC
does it use ttf computer modern?
ahopper
@ahopper
Dec 30 2018 19:53 UTC
nothing clever by me here btw, I just polished a port.
Just leave a comment in that PR to request features
ksigne
@ksigne
Dec 30 2018 19:54 UTC
ah, ok
so then you use drawpositiontedtext?
Benedikt Stebner
@Gillibald
Dec 30 2018 19:59 UTC
Yes. This will change when TextBlob is introduced
ksigne
@ksigne
Dec 30 2018 20:08 UTC
Well, then it makes sense to agree which units should horizontal spacing should be
I tend to 1 = 100%, 0 = 0% (all letters close to each other without spacing)
Benedikt Stebner
@Gillibald
Dec 30 2018 20:31 UTC
There is still some work to do in the text layout PR. When that is ready for testing I will work on features like TextDecorations, Glyphs(GlyphRun) etc.
Kermalis
@Kermalis
Dec 30 2018 21:58 UTC
@ahopper the problem with :pointerover in styles is I don't see how I can run C# code in my class when the IsPointerOver value changes