Microsoft YaHei is not working properly in SciChart 3D WPF - wpf

I am testing SciChart3d for wpf, setting the font on the X axis to Microsoft YaHei, SciChart3d is not working, and the version of SciChart3d is 5.3.0.11954.
<s3D:SciChart3DSurface x:Name="SciChart" Grid.Column="1" BorderThickness="0" WorldDimensions="200,100,200">
<s3D:SciChart3DSurface.RenderableSeries>
<s3D:PointLineRenderableSeries3D x:Name="PointLineSeries3D" IsAntialiased="True" StrokeThickness="1">
<s3D:PointLineRenderableSeries3D.PointMarker>
<s3D:SpherePointMarker3D Size="5"/>
</s3D:PointLineRenderableSeries3D.PointMarker>
</s3D:PointLineRenderableSeries3D>
</s3D:SciChart3DSurface.RenderableSeries>
<s3D:SciChart3DSurface.XAxis>
<s3D:NumericAxis3D GrowBy="0.1,0.1" FontFamily="Microsoft YaHei"/>
</s3D:SciChart3DSurface.XAxis>
<s3D:SciChart3DSurface.YAxis>
<s3D:NumericAxis3D GrowBy="0.1,0.1" FontFamily="Microsoft YaHei"/>
</s3D:SciChart3DSurface.YAxis>
<s3D:SciChart3DSurface.ZAxis>
<s3D:NumericAxis3D GrowBy="0.1,0.1" FontFamily="KaiTi"/>
</s3D:SciChart3DSurface.ZAxis>
</s3D:SciChart3DSurface>
enter image description here

Support for Chinese, Japanese and extended character sets was added to SciChart WPF 3D in version 7. The release note can be found here:
scichart.com/scichart-wpf-v7-0-released
Improved SciChart 3D Text Rendering
Under the hood we’ve written a completely new, cross-platform, in-house DirectX text rendering engine. This allows us to draw high quality text with Unicode characters, Cyrillic, Arabic or special characters.
We’ve also added support for Japanese, Chinese and Korean characters to SciChart WPF 3D. This has been long requested but required the intensive rework of our cross-platform text rendering engine.
Here's an image of Microsoft YaHei working with SciChart WPF v7

Related

What's the Microsoft font that looks same/closer to 'Estrangelo Edessa'?

I am facing display issues with winforms in window 10 OS. The fonts used for forms is 'Estrangelo Edessa’. In windows 10, this font doesn't come installed by default and hence text/content looks ugly (cutoff/improperly sized). So i am thinking to change the font that looks closer to 'Estrangelo Edessa' and will be native to windows 7, 8 and 10. Please suggest one such font.
I suggest trying Verdana or Lucida Sans Unicode as they have similar proportions to Estrangelo Edessa. Alternatively, Calibri is narrower but otherwise similar and nicer to read.
You may also want to look into having your forms size the controls so text is never cut off, just in case. For example, all WinForms controls have a PreferredSize property.

Why is Typography.Capitals parameter ignored?

I have applied SmallCaps as shown below, but it doesn't seem to have any effect on in the browser or in a design window.
<TextBlock Text="Text Here !" Typography.Capitals="SmallCaps"/>
Why is Typography.Capitals parameter ignored? Are there any settings that need to be enabled for this ?
UPDATE
It seems that for these properties to work, the font used must support them. Silverlight can not perform magic with the font, it can only work with the features built into the font itself. And it seems that there are some differences between different versions of Windows, which made this even more confusing. I have tried this on Windows 7 and 8 using the following fonts:
Gabriola, Georgia, Verdana, Arial, Comic Sans MS, Calibri, Segoe UI, Portable User Interface
On both Win7 and 8 the only properties that ever worked were SmallCaps and AllSmallCaps. None of the other settings made any difference whatsoever, neither on Win7 or Win8. On Windows 8 these two properties worked for all the fonts listed above. On Windows 7 the only fonts where they did work were Calibri and Gabriola. I then started looking into the versions of the fonts installed on the two different machines. It turns out they are different. For example, on my Win7 machine both Verdana and Segoe UI is of version 5.05. On the Win8 machine Verdana is version 5.31 and Segoe UI is version 5.28.
So I think this is why we get different results on different machines. It has nothing to do with Silverlight, but with the versions of the fonts installed on the client machine. The version of Verdana installed on Win7 has no support for SmallCaps and AllSmallCaps, but the version that comes with Win8 does have that support.
END UPDATE
I am definitely seeing a difference with SmallCaps and AllSmallCaps. The rest of the values don't seem to do anything. It could depend on the FontFamily used I suppose. Any way, the following code renders like the screen shot below.
<ContentControl FontSize="18"
FontFamily="Segoe UI">
<StackPanel>
<TextBlock Text="Writing Some Text Here in the Text Block. AllPetiteCaps"
Typography.Capitals="AllPetiteCaps"></TextBlock>
<TextBlock Text="Writing Some Text Here in the Text Block. AllSmallCaps"
Typography.Capitals="AllSmallCaps"></TextBlock>
<TextBlock Text="Writing Some Text Here in the Text Block. Normal"
Typography.Capitals="Normal"></TextBlock>
<TextBlock Text="Writing Some Text Here in the Text Block. PetiteCaps"
Typography.Capitals="PetiteCaps"></TextBlock>
<TextBlock Text="Writing Some Text Here in the Text Block. SmallCaps"
Typography.Capitals="SmallCaps"></TextBlock>
<TextBlock Text="Writing Some Text Here in the Text Block. Titling"
Typography.Capitals="Titling"></TextBlock>
<TextBlock Text="Writing Some Text Here in the Text Block. Unicase"
Typography.Capitals="Unicase"></TextBlock>
</StackPanel>
</ContentControl>
I'm not sure how much difference there is between WPF and Silverlight on this, but apparently for WPF the font has to be an OpenType font. According to wpf.2000things.com:
WPF includes a Typography class, which allows setting various attached properties for textual elements. These properties only affect text that is rendered using an OpenType font.
And in Programming WPF, 2nd Edition:
WPF supports both TrueType and OpenType fonts. OpenType fonts often contain
many alternates to the basic set of character shapes in order to support advanced
typographical functionality. If you are using a low-level text-handling feature such as
GlyphRun, you can use these alternates directly, referring to them by glyph index. But
if you are using the higher-level elements, such as TextBlock or the FlowDocument
viewers, these can locate and use the appropriate glyphs for you. You can control
which character shapes are used with the attached properties defined by the
Typography class.

WPF font quality

I'm developing a WPF app but I've noticed that at certain font sizes the text doesn't render as nicely as the samples you see in Control Panel -> Fonts. I'm using large Segoe UI fonts (FontSize="36"), and the effect is more noticeable on the upright lines, e.g. a letter "U" might be slightly thicker on one side than the other.
).
The font quality improves at certain font sizes, e.g. FontSize="48" (which I believe is the equivalent of 36pt), but using a limited number of font sizes isn't always practical.
I can improve the font quality by applying the following properties to the TextBlock:-
TextOptions.TextFormattingMode="Display" TextOptions.TextRenderingMode="ClearType"
Given the improvement in quality I'm curious to know why WPF doesn't do this for all text, or is it down to performance? I was thinking of creating a global style to apply this to all controls, or will this cause a problem?
(I tried uploading a screenshot but SO must store images at a low quality, and you couldn't really make out the font problem).
Here is the blog post that the WPF Text team wrote about this feature.
Note for the TextFormattingMode:
Ideal Ideal text metrics are the metrics which have been used to
format text since the introduction of WPF. These metrics result in
glyphs’ shapes maintaining high fidelity with their outlines from the
font file. The glyphs’ final placement is not taken into account when
creating glyph bitmaps or positioning the glyphs relative to each
other.
Display In this new formatting mode, WPF uses GDI
compatible text metrics. This ensures that every glyph has a width of
multiple whole pixels and is positioned on whole pixels. The use of
GDI compatible text metrics also means that glyph sizes and line
breaking is similar to GDI based frameworks. That said, glyph sizes
are not the only input into the line breaking algorithm used by WPF.
Even though we use the same metrics as GDI, our line breaking will not
be exactly the same.
Since these properties are new in .NET 4.0, they kept the original WPF algorithm as default, which is Ideal mode.
For the TextRenderingMode
Auto This mode will use ClearType unless system settings have been
set to specifically disable ClearType on the machine.
Aliased No antialiasing will be used to draw text.
Grayscale Grayscale antialiasing will be used to draw
text.
ClearType ClearType antialising will be used to draw text.
Since Auto is default, you will generally get ClearType rendering.
Now, because these are attached properties, and they inherit, you can just set them at the root Window. No need to create a bunch of Styles.
I have noticed small performance issues when dealing with large amounts of data (upwards of 10,000 items) when ClearType is turned on. Changing TextFormattingMode to Display has no visible performance impact.
This said, in all of my WPF apps I use global styles to improve text rendering, unless the performance impact is large enough to make the UI feel sticky.

DropDownList missing font or string encoding issue

I have some Korean text I need to display on my WinForm. The text displays fine in my ListBox control. The same text does not display in my DropDownList control. Both controls have a font of Arial 8pt. The ItemHeight property for both controls is 14. I can't spot any differences in the properties of these controls that would mean one control displays the text correctly and the other doesn't.
I have read in the following article that the problem is either caused by the font or the character encoding.
From what I can gather, the code uses standard .NET strings. There are no character conversions taking place. The required font to display Korean must be installed, otherwise I would not be able to view it in one control and not another. What am I doing wrong?
I resolved this by changing the font from Arial 8pt to Arial Unicode MS 8.25pt. As Luis Quijada pointed out when he suggested I look at this question
ComboBox with Segoe UI and Japanese text
Changing the font from Arial to Arial Unicode MS was an acceptable workaround for me. I'm not sure which languages Arial is supposed to support. It's possibly a Microsoft bug that Arial works in the ListBox but not in the DropDownList for the Korean text.

MediaElement Markers Missing in WPF

I see that there is a Markers Property on the MediaElement, but this seems to be available to the Silverlight MediaElement, not the WPF MediaElement?
Can you help me with what I'm missing?
I'm trying to add Markers to a WPF MediaElement, to play a video and show popups based on the timeline. What should I be using in place of the Missing Markers collection?
Thank you for your help.
There are two aspects to your question depending on what you actually intended - please note that the MediaElement.Markers Property is a read only collection of timeline markers associated with the currently loaded media file:
What's a timeline marker?
Here's the MSDN description of the TimelineMarker Class:
A timeline marker is metadata associated with a particular point in a media file. These markers are usually created ahead of time and stored in the media file itself. They are typically used to name different scenes in a video or provide scripting cues. By handling the MediaElement object's MarkerReached event or by accessing the MediaElement object's Markers property, you can use timeline markers [...]
So timeline markers may be a good fit for encoding your popups, but it is important to note that they are a property of the media file itself and not the collection of graphical tick marks on the typical media players timeline widget!
How do I create and handle timeline markers?
The only article summarizing this I could find right now is How to encode video markers for consumption in Silverlight and WPF from Steven Porter. (Don't get fooled by the registration demand, it's the infamous technique from the evil hyphen site that motivated the creation of Stack Overflow in the first place, i.e. you can read the article just fine without registering, just keep scrolling down.)
How do I create a timeline control with tick marks in WPF?
Assuming this is what you're actually trying to achieve and why you stumbled over the MediaElement.Markers collection the answer is roll your own:
It's pretty simple though, basically you will need to customize a Slider control to your liking, see this example from the Slider Class documentation on how to use the Ticks property to create tick marks along the Slider at irregular intervals:
<Slider Width="100" Value="50" Orientation="Horizontal" HorizontalAlignment="Left"
IsSnapToTickEnabled="True" Maximum="3" TickPlacement="BottomRight"
AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="2"
Ticks="0, 1.1, 2.5, 3"/>

Resources