PDFsharp & MigraDoc Foundation http://forum.pdfsharp.com/ |
|
PDFSharp - Emojis in text? http://forum.pdfsharp.com/viewtopic.php?f=2&t=4326 |
Page 1 of 1 |
Author: | pmg1979 [ Wed Feb 16, 2022 4:35 pm ] |
Post subject: | PDFSharp - Emojis in text? |
Hi folks! I've been using PDFSharp in one of my apps but I've noticed that if we've got emojis in a text string they're not outputting correctly - I just get a rectangular shape instead. Can I check if this is a known limitation or if there's anything I need to look out for when outputting such content? Thanks all and apologies if this is a newbie question Mike |
Author: | TH-Soft [ Wed Feb 23, 2022 3:02 pm ] |
Post subject: | Re: PDFSharp - Emojis in text? |
This is a limitation of the current implementation. Code that supports surrogate pairs can be found via this page: https://github.com/empira/PDFsharp-1.5/issues/63 |
Author: | NeilPearson73 [ Sat Sep 16, 2023 1:06 am ] |
Post subject: | Has anyone been able to get emojis to render properly. |
I have done research on this for a couple days and have only found that PdfSharp/MigraDoc just do not support surrogate pairs. I hear that there is a pull request with a fix for this, but I can't find the code anywhere. Has anyone been able to make this work? |
Author: | NeilPearson73 [ Sat Sep 16, 2023 1:09 am ] |
Post subject: | Re: PDFSharp - Emojis in text? |
the link doesn't resolve. Is this code available anywhere? |
Author: | TH-Soft [ Sun Sep 17, 2023 4:08 pm ] |
Post subject: | Re: PDFSharp - Emojis in text? |
NeilPearson73 wrote: the link doesn't resolve. The link works.
|
Author: | TH-Soft [ Sun Sep 17, 2023 4:09 pm ] |
Post subject: | Re: Has anyone been able to get emojis to render properly. |
Code that supports surrogate pairs can be found via this page: https://github.com/empira/PDFsharp-1.5/issues/63 |
Author: | NeilPearson73 [ Tue Sep 19, 2023 1:32 am ] |
Post subject: | Re: Has anyone been able to get emojis to render properly. |
TH-Soft wrote: Code that supports surrogate pairs can be found via this page: https://github.com/empira/PDFsharp-1.5/issues/63 Perfect, that was precisely what I needed! Thanks! I had to apply all the code changes that @TheRealSourceSeeker suggested but in the end it works great. Now if I could only get color emojis to work. |
Author: | (void) [ Sat Sep 23, 2023 8:45 am ] |
Post subject: | Re: PDFSharp - Emojis in text? |
I recently got colored emojis working in the current 6.0 version by supporting color-tables stored in font-files. I took the code from the mentioned issue and expanded from there. See this commit (and this for a small optimization) Note there are 2 Versions of color-tables (Version 0 and Version 1). https://learn.microsoft.com/en-us/typog ... /spec/colr Version 0 basically supports only "flat" colors per layer. Version 1 is more advanced, supporting gradients and such. The code in the commit ONLY supports version 0 tables I have to admit i'm absolutely NOT an expert regarding encodings, font-handling and what have you; so be aware the code may contain flaws that are not obvious to me. That said, i testet this successfully with the Segoe UI Emoji font, which has a version 0 color table. I also added a test-case to render all characters supported by a certain font. All characters of the mentioned Emoji font showed up correctly (as far as i can tell). I'm not 100% certain, but it should not be too hard to port this to 1.5, if you need it there. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |