Android Question Typeface Monospace Style_Italic

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I have labels that were made in Designer with a Typeface of MONOSPACE Style ITALIC

When I create a New label on a panel I am displaying in ScrollView2D and assign it a typeface of
B4X:
Typeface.CreateNew(Typeface.MONOSPACE, Typeface.STYLE_ITALIC)

It appears as MONOSPACE but does not have the ITALIC style

Is designer doing something different in its label creation?

The code for the label I create is as follows:
B4X:
  Dim AnotherPlayer  As Label
                 
  AnotherPlayer.Initialize("")
  AnotherPlayer.Gravity  = Gravity.LEFT + Gravity.CENTER_VERTICAL
  AnotherPlayer.Typeface = Typeface.CreateNew(Typeface.MONOSPACE, Typeface.STYLE_ITALIC)
  AnotherPlayer.TextSize = 16

Which matches exactly what I have in the labels I create in Designer. Why is the ITALIC style not taking effect?

BobVal
 

stevel05

Expert
Licensed User
Longtime User
It works OK for me on a standard label directly on the Activity, Android 6.0.1 Asus Nexus 7. I don't have the Scrollview2d library installed to try it on though.
 
Last edited:
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Just to make sure we are trying the same thing.
1) I have a panel (PanelX) created in designer (that has labels with typeface Monospace / Style Italic
2) Add this PanelX to a ScrollView2D
3) Add a label field to the to PanelX (with typeface Monospace / Style Italic)

I've added fields in other places without any problems - but in this case the "Italic" part of the typeface isn't taking. The font looks like Monospace but not Italic
 
Upvote 0

mberthe

Member
Licensed User
Longtime User
I had exactly the same problem : I have not found a solution with the tyface property: I used a richstring to display the text of the label in bold
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Understood, I have a way around it (I created extra fields in designer that I have hidden and un-hide them and move into position when needed)

But this seems like a sure bug to me.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
The Fields in Yellow were created in Designer and the Field in Red was created in code.
ALL use Monospace and Style or ITALIC or BOLD_ITALIC but the Italic option does not seem to be working

Included test code example

If it matters I am using a Samsung Galaxy Tab-3 (SM-T210R)

 

Attachments

  • TestCodeSV2D.zip
    10.9 KB · Views: 282
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The app works as expected on my Asus Nexus 7. Just running it, I get Bold Italic font in blue for data in the NewPlayer box.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Strange that it always seems to work from designer but not from a APP
Maybe we should move this the BUG area?

I don't have rights to do this

ALSO Klaus: Did you change the FONT size. Because that sure seems a LOT larger then what it should be.

BobVal
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
It can't be classified as a bug as it is proven to work as expected on some devices at least, rather it seems to be a difference in manufacturers implementations (again), and there would be nothing Erel can do about it within B4a. If you have a workaround, I suggest that you use that so you know it will work on all devices. This thread will serve as documentation of the issue for anyone else that comes across it.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
ALSO Klaus: Did you change the FONT size. Because that sure seems a LOT larger then what it should be.
No.
But I know why it is bigger.
In the Designer you have AutoScaleAll.
The layout variant is 999 x 600 scale 1.
My device is 1080 x 1920 scale 3 which means 640 x 360 scale 1 sothe text size is downscled.

Below an image without AutoScaleAll.

 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
As for not being classified as a bug. I beg to differ on that. If we can create labels in designer that work properly on a device then we should be able to do the same thing in code. What / How is designer setting the fields to appear properly that we are not doing in code?

If the fields did not appear properly from designer in different devices then I would say this would be a device bug. But I think this is a bug

BobVal
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Yes I agree, a bug in the Manufactures implementation.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Good point but, why does it work on some devices and not others?

Perhaps we'll have to leave it to Erel to have a say.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…