Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't seem to work. What am I doing wrong? #46

Closed
mike-ward opened this issue Jun 9, 2021 · 7 comments
Closed

Doesn't seem to work. What am I doing wrong? #46

mike-ward opened this issue Jun 9, 2021 · 7 comments
Labels
bug fixed in main Fixed in the main branch

Comments

@mike-ward
Copy link

mike-ward commented Jun 9, 2021

Added to my WPF project and updated .XAML accordingly. Still seeing b/w emojis.

image

I pushed my code to https://github.com/mike-ward/tweetz (master branch).

Maybe someone can point out the error of my ways? 😕

Running on Windows 10

@samhocevar
Copy link
Owner

This is because the library is hooked on the dependency property for TextBlock.Text, whereas you are using inline objects such as <Run>. I am prototyping fixes for the problem.

samhocevar added a commit that referenced this issue Jun 25, 2021
This loosely addresses #46 but I think an emoji:Run object would be preferable.
@samhocevar samhocevar added the bug label Jan 3, 2023
@samhocevar
Copy link
Owner

samhocevar commented Jan 3, 2023

Not sure if you are still interested, but there are new features in Emoji.Wpf v0.3.4 that make it now very easy.

In FlowContentService.cs I just modified your Run() method so that it calls SubstituteGlyphs() when the Run is inserted in a document:

private static Run Run(string text)
{
    var run = new Run(ConvertXmlEntities(text));
    run.Loaded += (o, e) => (o as Run).SubstituteGlyphs();
    return run;
}

This is the result:

image

@samhocevar samhocevar added the fixed in main Fixed in the main branch label Jan 3, 2023
@mike-ward
Copy link
Author

mike-ward commented Jan 3, 2023

Much nicer. I am noticing a performance hit on rendering. Scrolling in my program is janky when using Emoji.Wpf

@samhocevar
Copy link
Owner

I noticed that, too. The profiling tools I have access to have much improved and I am currently having a closer look at performance. There have already been improvements (see #63) but unfortunately I don’t think they will apply to Tweetz.

@mike-ward
Copy link
Author

mike-ward commented Jan 3, 2023

I peeked at your code and didn't see anything obvious that could be improved. The emoji rendering is pretty expensive I imagine. Thanks for your efforts.

@samhocevar
Copy link
Owner

FYI I have created a new sample program (Samples/LoremIpsum.csproj) to stress test TextBlock in a virtualised listbox. I believe its behaviour is very close to Tweetz, so I’ll focus on optimising that.

I will close this issue because it is not directly related to performance, but you’ll be able to track progress in #63.

@wegylexy
Copy link

wegylexy commented Sep 7, 2023

Reusing a <Run> by changing its .Text and then invoking .SubstituteGlyphs() does not clean up previous substituted glyphs but accumulate residues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixed in main Fixed in the main branch
Projects
None yet
Development

No branches or pull requests

3 participants