Symbols, Special character display issue in wpf - wpf

In WPF text block, I want to display special characters like diamond (♦) etc. It is displaying fine in some systems and in some systems, it is displaying a plain box instead of the symbol.
Can somebody help me to resolve this issue.
Thanks in Advance.
-Elangovan.

When you want "special characters" you should probably use images instead of depending on fonts. For one thing, you have no guarantee that the user will have the font you use.

Related

ToolTip works very slow for long text (2000+ chars)

We need to use the built-in WinForms tooltip control to display a very long tooltip (about 4000 characters) for one of our controls. But if we do so, the form freezes for a minute or two when we place the mouse pointer into the target control to see the tip. And nothing happens after that.
We experimented and detected that the standard tooltip starts to work very slow when it has about 2000 chars, and the situation becomes much worse when we increase the number of chars. Is it a known issue, and is there any workaround for it? Please, don't suggest to trim the tip text - we need to display the string as is.
When you assign a string of text to a ToolTip, part of the process of drawing it involves calls to USP10.dll which handles Unicode layout of characters on screen. I was able to see this by looking at the stack trace while the program was freezing. The performance of this layout is terrible for long strings.
Disabling Visual Styles for the application (commenting out EnableVisualStyles()) fixed the problem - the tooltip displays immediately, though this is not an optimal solution.
I kept looking and found this page which indicates the problem may be linked to layout of long strings where word-wrap is necessary. By inserting line breaks into the tooltip text, I found that the string displayed immediately. So, if you can determine where to insert the line breaks manually, the ToolTip should display quickly.
What about using another Tooltip , i.e. HtmlToolip?

richtextbox printing with fixed header and footer

Hell Everybody,
I need to provide a facility like letters printing.for letter formats i used a richtextbox to create different formats(Templates).now i need to print this formats with header.Heder information will change always and header height should be fixed for the page.For header informtion displaying also i took one Richtextbox.now i want to merge these two richtext box information before printing.but i failed to maintained the fixed header,if i merge the textboxs information.
Suggest me,what way is better to handle this.

Best framework for new application which handle text(fonts,characters)

I need to create application, using which user can handle text in graphical interface.
User can move text objects inside parent panel/canvas or something, change fonts, change size of characters (height, width), spacing between characters and so on.
Target of application:
in the end of handling text (or while handling) user will get a position of every character, height and width of characters, distance between characters (spacing). And all those measures must be in same unit of measure (pixels, points).
So question is: What kind of framework (.NET, Silverlight, XNA, Flash, Java, HTML 5, Javascript and so on) can be used for this.
I am “sold my soul” to Microsoft (worked before only with .NET), but have some experience in Flash, HTML, Javascript, Java. So all proposals are welcome
Trying to approach with Silverlight, but only problem was with spacing (dynamically change), when trying used Glyphs it worked in some way,
only problem was: when with Glyphs spacing was changed(same for all characters), in visual spacing was different for all characters. So spacing problem is biggest for right now.
Another approach can be a handle text as a collection of characters, and calculate by myself distance between characters. But in application every user can use own custom fonts (here my knowledge not enough). So i afraid that we will need to create (draw) every character of font before can use custom fonts.
I found in Internet some applications which doing almost same thing (done in Javascript), but before start want to get more information about other possibilities.
With nobody give some advices about this,I decide to answer own question, because found already a solution how will approach to this project.
So I found a new(for me at least) version of Silverlight hav a new Property CharachterSpacing for Elements which handling with text(TextBox, Label and so on). Using this property I can change dynamically a text spacing.
Documents tell us that this property use as a unit integer which is 1000s of font's em unit. About em:
"Em size is a typographical measure that specifies the approximate width of the capital letter "M" in the Roman alphabet, measured in the units that are prevalent in a particular technology. Silverlight em sizes are given in pixels. The apparent visual size of the em size varies per font.”
So this give a very good basement for counting a real distance between charachters.

Xlib: draw a text input box and read text as it is typed

I am trying to implement a text box where a user can type, use arrow keys, backspace, delete, etc. I would like to be able to know what is in this text box without the user needing to submit anything. I suppose I could catch keypress events, find a way to display a cursor, and basically build a min-text-editor by hand--but maybe that would be reinventing the wheel?
What I am after is rather scrabble-like. You have several letters in the top part of a window and a text box in the bottom. Each time you type a letter it disappears from the top pane so that you know when you've used them all up. I want to be able to edit that text with the arrow keys, 'cause rather than the 7 letters scrabble would give me I hope to be doing this with paragraphs.
I have the window displaying, and the source file processed and displayed as a list of allowable letters... I just want to update the list of allowable letters while the user types in their sentence. Can Xlib do this? Is there something else that might be more suitable? Thanks!
Can Xlib do this?Why yes, Xlib can do a lot of things. What you describe seems simple enough by using X's event processing and drawing functions.
Xlib is pretty crufty, though, and IMO you should only use it if you need closeness to the X protocol. (Even then there are newer replacements like XCB. But I digress.)
You might find it easier to work with a modern toolkit, like GTK+ or Qt.
For example, this might be expressed as a GtkEntry with a "key-press-event" handler.

Detect whether a font supports variants (like superscript and subscript)

WPF has the Typography.Variants attached property that lets you do superscript and subscript. However, it only works for some fonts. For other fonts, the variant is utterly ignored, and the text is shown normally. (Code sample and screenshot here)
Since it silently falls back to a no-op, I have no idea that anything went wrong; but my user will see lousy behavior.
Is there any way that I can programmatically detect whether a given font supports Typography.Variants? If so, I could provide more meaningful behavior if the user selected a non-variant-supporting font for something that needs superscripts/subscripts.
I looked at GlyphTypeface, since it's the one you use to query whether a font can be embedded, but I didn't see anything there about variants. I also didn't see anything obvious on FontFamily, and the only thing I could find on Typography was the Variants attached property itself (and its getters and setters).
As far as I can tell, WPF provides no information about the available GSUB tables (which tell you this information). Everything is hidden deep within private classes of PresentationCore.
One way would be to use the advanced text services of WPF to create a TextFormatter, and then retrieve the GlyphRuns created by a piece of text with the variants on, and one with the variants off, and then compare the glyph indexes used.
Another way would be to physically examine a font's data through GlyphTypeFace.GetFontStream(). The TrueType font format is not very complicated, so you'll probably find some information on the net on how to parse the binary font data to find information on the GSUB tables.
Note that simply asking wither a variant is supported is also a little ambiguous. A font can say it supports a variant, but nothing requires it to actually provide any meaningful substitutions. Most Adobe fonts provide only a few alphabetical lowercase characters for things like superscript and subscript (not even the entire Latin alphabet, mind you). Which is pretty useless, IMHO, since you can't ask WPF to fake subscripts or superscripts like Word and other word processors do.
Still, it would have been nice if you could simply ask TypeFace.GetSupportedOpenTypeFeatures().

Resources