-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add a Vertical Text Block to the Windows Community Toolkit #2544
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
Conversation
… nmetulev/directwritetextblock
Nmetulev/directwritetextblock
pull latest community toolkit into my fork.
…d to the DirectWriteTextBlock which only appears in high contrast to make it look like standard XAML text block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added few comments. Also need to integrate project with build script to generate nugets
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DirectWriteTextBlock/DirectWriteTextBlockCode.bind
Outdated
Show resolved
Hide resolved
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DirectWriteTextBlock/DirectWriteTextBlockCode.bind
Outdated
Show resolved
Hide resolved
Microsoft.Toolkit.Uwp.UI.Controls.WinRT/DirectWriteTextBlock/DirectWriteRenderArgBuilder.cpp
Show resolved
Hide resolved
Microsoft.Toolkit.Uwp.UI.Controls.WinRT/DirectWriteTextBlock/DirectWriteRenderArgBuilder.cpp
Show resolved
Hide resolved
Microsoft.Toolkit.Uwp.UI.Controls.WinRT/DirectWriteTextBlock/DirectWriteTextBlock.cpp
Outdated
Show resolved
Hide resolved
...ft.Toolkit.Uwp.UI.Controls.WinRT/UniversalWindowsAppPackageFontLoader/FontCollectionLoader.h
Outdated
Show resolved
Hide resolved
...soft.Toolkit.Uwp.UI.Controls.WinRT/UniversalWindowsAppPackageFontLoader/FontFileEnumerator.h
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,53 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are moving the documentation to https://github.com/MicrosoftDocs/WindowsCommunityToolkitDocs. Please open a docs PR there and remove docs from this PR
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> | ||
<AppContainerApplication>true</AppContainerApplication> | ||
<ApplicationType>Windows Store</ApplicationType> | ||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target version should be 17763
…lev/directwritetextblock
* Move font loader into DirectWriteTextBlock folder as it's just there to map UWP into DirectWrite anyway. Rename it. * Fix documentation bugs * Fix comment at top of files. * Make TextOrientation to be ReadingDirection and map it directly into DirectWrite * Make some more custom enums (having a lot of issues getting C# to see these in the .bind file). * Add retry logic to rebuild D3D device which is required sometimes.
@azchohfi what behavior do you see? Maybe this is a HW issue with a specific device or OS specific (I tested on 17763 on a Surface Laptop 2)? @juma-msft looks like there's a conflict in samples.json now too, can you update? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've found the issue. If your display scale is 100%, everything works as expected, but if you change to 150%, for example, it will render outside the layout of the control. Not sure if the layout process is not considering the scaling factor or if your DirectDraw code is not using it. It's one or the other, but this a merge blocker. And still, we need the docs.
… when DPI is set to 1.25 or a non round DPI.
Pull everything into my fork from windows tool kit master.
Yeah I figured out the scaling issue tonight, it was a problem with where the scale was being applied and fixed it. |
I also just fixed the conflict in the samples.json |
hold on from looking at the PR, the merge with samples.json didn't work correctly. Correcting that now. |
Does the control only render horizontal text rotated? The CSS writing-mode property supports horizontal and vertical text formatting, so Japanese and Chinese characters will be laid out vertically one character above the other, but the glyphs do not rotate. |
No, this control basically does what the dwrite did and what css does. Basically it supports the punctuation and quotation justification for vertical text in Japanese which just rotating the text won't do. For latin languages, it more or less just looks like a rotation. |
@juma-msft getting back to this for 6.0 now. Looks like another conflict. To confirm this is still C++/CX not C++/WinRT? |
This is still C++/CX. |
…mmunityToolkit into windows-toolkit-master
This reverts commit 0b48539.
…d."" This reverts commit 0cf811f.
Thanks @juma-msft would it be hard for us to convert to C++/WinRT? I know there was some initial issues with the tooling, but hopefully those would be fixed now? We have some more C++ stuff coming in the future for us to share the new namespace with, but that's going to be C++/WinRT code, so it'd be nice if we could stick to one flavor. Any thoughts? |
@juma-msft, @azchohfi and I have discussed trying to switch C++ code in the Toolkit to C# as that's where the majority of our community/contributors. It makes it easier for us to manage as well as a whole and simplifies our pipeline. Do you still have interest in this control? Is this something we should talk about contributing to WinUI now that they work in the open source space (either 2.x or 3.0 (in the future))? FYI @ranjeshj - would this make sense as an extension/alternate mode for the built-in TextBlock instead? Have you discussed this type of formatting options for applications in general? What are your thoughts in general here? Thoughts? |
@codendone as FYI |
At this point, we've decided to try and keep the WCT as C# only, see #3427. @juma-msft I think this is still an important topic though to discuss with the WinUI team. We should open an issue on their repo and continue the discussion there for the future? |
Issue: #2441
PR Type
What kind of change does this PR introduce?
Feature
This implements a TextBlock like control which can render vertical text. Basically it just uses DirectWrite to render an Image which is then shown using a XAML Image object and SurfaceImageSource. The control itself supports High Contrast like XAML by overriding the foreground + background of the text block when High Contrast is turned on. Narrator reads out the "text + Image" which while accurate, isn't exactly what I want. That being said since text blocks tend to be in something else, it might be ok.
Build or CI related changes
This required a fix from Nikola to support the Generated Files folder.
Documentation content changes
This adds documentation for the new control (DirectWriteTextBlock) in English. There are plans to translate to Japanese if the initial changes can go through.
Sample app changes
There is a new page in the Sample App for the new control which can be played with.
What is the current behavior?
There is no control which supports rendering text vertically in XAML and making sure all of the individual locale behaviors are held in vertical text (ja-JP or Traditional Mongolian) is only really supported with Direct Write.
What is the new behavior?
A Control which renders text using DirectWrite has been introduced.
PR Checklist
Please check if your PR fulfills the following requirements:
Other information
This currently doesn't contain a designer project. I'm hoping to get this checked in though if that's required, I can resubmit later.