tag:blogger.com,1999:blog-8715120618224381002.post7396023849495738869..comments2024-01-31T05:36:46.775+00:00Comments on This is an EX blog...: GlyphRun and So ForthDanielhttp://www.blogger.com/profile/11384619047799752406noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-8715120618224381002.post-15221080395813850822011-02-04T07:12:58.844+00:002011-02-04T07:12:58.844+00:00I could not digest this immediately.
But a quick ...I could not digest this immediately. <br />But a quick question ,<br />I am basically in need to calculate the height of the line with the specified font in RichText box. <br />Can we do it using GlyphRun ?bhalgatashishhttps://www.blogger.com/profile/00700842085721034787noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-54442445214274428212010-05-28T13:31:26.272+01:002010-05-28T13:31:26.272+01:00My guess is the bidiLevel parameter defines the te...My guess is the bidiLevel parameter defines the text orientation. It is derived from Unicode bidi algorithm described in the Unicode standard. Generally if the text you want to display does not contain Unicode control characters and contains only left to right characters + neutral characters this routine will be useful. For the more advanced stuff check out the free C# bidi implementation (you can also try to optimize it to support incremental bidi processing which is kind of hard :))Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-55611586020510606972009-03-11T13:30:00.000+00:002009-03-11T13:30:00.000+00:00Oh right. That is very smart! Thanks so much!Oh right. That is very smart! Thanks so much!AgeKayhttps://www.blogger.com/profile/17559801667744126942noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-40451871256447030522009-03-11T13:27:00.000+00:002009-03-11T13:27:00.000+00:00To rotate the text you would push a RotateTransfor...To rotate the text you would push a RotateTransform onto the DrawingContext by calling PushTransform, before doing the drawing. Afterwards, call Pop on the DrawingContext so the rotation won't apply to any subsequent drawing.Danielhttps://www.blogger.com/profile/11384619047799752406noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-37318988946926077632009-03-11T12:04:00.000+00:002009-03-11T12:04:00.000+00:00This is great. I adapted your code and it's 30x fa...This is great. I adapted your code and it's 30x faster than the build-in DrawText method. But now I want to draw the text at a 90 degree angle. Do you have an idea on how to do that?AgeKayhttps://www.blogger.com/profile/17559801667744126942noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-88561983580777436412009-02-05T07:10:00.000+00:002009-02-05T07:10:00.000+00:00thank your help.i want to calculate the width of a...thank your help.i want to calculate the width of a character,the GlyphTypeface can get it.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-30069936698603065902009-01-27T21:35:00.000+00:002009-01-27T21:35:00.000+00:00Depends what you're extending. I've done a syntax ...Depends what you're extending. I've done a syntax highlighting editor by using RichTextBox and simply applying formatting to it whenever the user edits the text. Works okay for small snippets of code. The drawback to working on GlyphRuns is that you may not be passed enough text in each run to figure out how to highlight it. Also you will only be able to overwrite in a different color - bold text would need extra space, so that would be impossible.Danielhttps://www.blogger.com/profile/11384619047799752406noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-85496626536051479332009-01-27T18:45:00.000+00:002009-01-27T18:45:00.000+00:00Great, thanks for the explanation Daniel. I had a...Great, thanks for the explanation Daniel. I had an idea for syntax highlighting by drawing a new GlyphRun over an existing one, do you think that's a terrible idea?Unknownhttps://www.blogger.com/profile/04957951721926103192noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-59170735196365829002009-01-27T11:49:00.000+00:002009-01-27T11:49:00.000+00:00@electroglyph - sorry I didn't make that clearer. ...@electroglyph - sorry I didn't make that clearer. Above the sample it says I'm rendering to a DrawingContext - that's what dc is. You can get one passed to you by deriving your own class Foo from FrameworkElement and overriding OnRender. Then reference your Foo in your XAML to get it to appear on the screen.Danielhttps://www.blogger.com/profile/11384619047799752406noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-42005454193012430382009-01-27T10:21:00.000+00:002009-01-27T10:21:00.000+00:00what's the "dc" in your code sample?what's the "dc" in your code sample?Unknownhttps://www.blogger.com/profile/04957951721926103192noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-65643978611313416952008-08-21T06:33:00.000+01:002008-08-21T06:33:00.000+01:00Just now I checked DrawGlyphRun with Arabic text, ...Just now I checked DrawGlyphRun with Arabic text, seems this routine is just a <B>Glyph Renderer</B> and it doesn't look at special tables in OpenType font, e.g. GPOS, GSUB...<BR/><BR/>And about the performance, the FlowDocument is still much faster than DrawText (and it's friends).<BR/><BR/>I wish I had access to FlowDocumentScrollViewer source, so I could tune it to my special needs!A.V.Ebrahimihttps://www.blogger.com/profile/02081719244388930980noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-83509092731073481522008-08-21T05:29:00.000+01:002008-08-21T05:29:00.000+01:00Great document about undocumented fact!I don't kno...Great document about undocumented fact!<BR/>I don't know it supports Arabic RTL and GPOS table of font, but worth a try.A.V.Ebrahimihttps://www.blogger.com/profile/02081719244388930980noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-51490255639386992212008-08-11T09:40:00.000+01:002008-08-11T09:40:00.000+01:00What I had in mind was: Label, TextBlock, FlowDocu...What I had in mind was: Label, TextBlock, FlowDocument and its associated viewers, FormattedText, GlyphRun. Arranged in an approximate order where you get more power, but more responsibility, like gradually turning into Spider-Man.Danielhttps://www.blogger.com/profile/11384619047799752406noreply@blogger.comtag:blogger.com,1999:blog-8715120618224381002.post-73276812897822925642008-07-31T08:15:00.000+01:002008-07-31T08:15:00.000+01:00Fabulous post Daniel; so useful for the code I'm w...Fabulous post Daniel; so useful for the code I'm writing at the moment. Thank you. When you say "In WPF there are a number of ways to get text painted, ranging from Label at the simple end, all the way down to GlyphRun" would you enumerate all the techniques inbetween?dumbledadhttps://www.blogger.com/profile/04348558803939966398noreply@blogger.com