Nefrach
Topic Author
Posts: 3
Joined: 07 Apr 2018, 19:16

Text align

14 Apr 2018, 23:54

Why do WPF and Noesis align text differently (left WPF, right Noesis)? Image

I guess it makes it difficult to develop with Blend but I am not sure, maybe I am doing something wrong - I am new to XAML/Noesis/WPF.
 
Wanderer
Posts: 146
Joined: 08 May 2017, 18:36

Re: Text align

15 Apr 2018, 13:47

how you align text, as text, or whole textBlock / label in to button grid?
Try in Blend set all align changes in to local (click on the rectangle button nex to align settings and set Change in to Local) then export your xaml in to noesis.
 
Nefrach
Topic Author
Posts: 3
Joined: 07 Apr 2018, 19:16

Re: Text align

16 Apr 2018, 00:45

Yes, I am applying VerticalAlignment="Center" to TextBlock. Sadly, your solution didn't help but thanks! Its not centered in Blend and in Noesis XamlPlayer. I could play with different padding/margin settings but the fact that Blend/WPF and Noesis center the text differently just stops me from doing that... Any tips?
 
User avatar
sfernandez
Site Admin
Posts: 1284
Joined: 22 Dec 2011, 19:20

Re: Text align

16 Apr 2018, 11:58

Could you please create a ticket in our bugtracker and share the .ttf/.otf file that is not correctly centered?
We rely on truetype default metric tables to calculate font's height, maybe that font does not provide these metrics in a standard way.
 
User avatar
jsantos
Site Admin
Posts: 2065
Joined: 20 Jan 2012, 17:18
Contact:

Re: Text align

17 Apr 2018, 14:51

Please, if you can, also attach a small XAML with the problem. Thanks!
 
Nefrach
Topic Author
Posts: 3
Joined: 07 Apr 2018, 19:16

Re: Text align

18 Apr 2018, 10:42

When I click on bug tracker it asks me my nick and pass. After I enter them it tells me I am either blocked or my info is incorrect.

So I am going to post the small code sample here. Also, the font can be downloaded from here: https://www.dafont.com/headliner-no-45.font
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008">

    <Grid Background="Black">
        <Border Width="300" Height="40" Background="White" Padding="0">
            <TextBlock FontFamily="Fonts/#Headliner No. 45" TextAlignment="Center" FontSize="34" VerticalAlignment="Center" Foreground="Black">
                This is a test
            </TextBlock>
        </Border>
    </Grid>
</Page>
 
User avatar
jsantos
Site Admin
Posts: 2065
Joined: 20 Jan 2012, 17:18
Contact:

Re: Text align

18 Apr 2018, 10:59

When I click on bug tracker it asks me my nick and pass. After I enter them it tells me I am either blocked or my info is incorrect.
You need to create a new account for the tracker (can be same user and passwd if you want). Please, upload the issue there, it is easier to track there. Thanks!
 
Wanderer
Posts: 146
Joined: 08 May 2017, 18:36

Re: Text align

18 Apr 2018, 12:31

I have same bug with ContentPresenter inside comboBox. The text is different align (similar to picture posted in first post) when I use ContentPresenter inside button and have Horizontal and Vertical Aligmment set to stretch.

But I found workaround, if ContentPresenter have Vertical Aligmment set to Center, then it is working as expected.

Btw. I use basic font from Noesis (Roboto).
 
User avatar
sfernandez
Site Admin
Posts: 1284
Joined: 22 Dec 2011, 19:20

Re: Text align

19 Apr 2018, 11:10

I have same bug with ContentPresenter inside comboBox. The text is different align (similar to picture posted in first post) when I use ContentPresenter inside button and have Horizontal and Vertical Aligmment set to stretch.

But I found workaround, if ContentPresenter have Vertical Aligmment set to Center, then it is working as expected.

Btw. I use basic font from Noesis (Roboto).
In your case what you see is normal, is not the same issue. HorizontalAlignment/VerticalAligment Stretch option will make the ContentPresenter fill all the available space in the Button. And a TextBlock starts to render its text on the top left corner of its available space.

If you want text inside a Button to be centered, you need to set ContentPresenter's HorizontalAlignment/VerticalAlignment to Center in Button's template.

Who is online

Users browsing this forum: No registered users and 9 guests