Forum Xamarin Xamarin.Forms

Using HTML for a Label -- font changed unexpectedly

BobWhittenBobWhitten USMember ✭✭

I have a lot of design now using large Label controls with text, but now of course someone wants these to have some minor formatting (bold, italic).

I'm hoping I can easily do this with TextType="Html", by just adding (bold tag)bold me(close bold tag) stuff... (sorry, markdown is interpretting my tags)

and IT WORKS, but ...

The text displayed now is smaller, and in Times Roman. I liked it with the original font (honestly, not sure what that is).

Is there any magic HTML I can put in that says "leave the font I started with"?

Tagged:

Best Answer

  • BobWhittenBobWhitten USMember ✭✭
    Accepted Answer

    Oh, I found it...

    https://stackoverflow.com/a/32410620/1758350 - Let iOS pick the System Font Helvetica Neue or San Francisco in CSS

    <html><head> <style type ="text/css">body{font-family: '-apple-system','HelveticaNeue'; font-size:17;}</style> <style>body {text-align: center;}</style> </head><body> This should be <b>bold</b> text </body></html>

Answers

  • BobWhittenBobWhitten USMember ✭✭
    Accepted Answer

    Oh, I found it...

    https://stackoverflow.com/a/32410620/1758350 - Let iOS pick the System Font Helvetica Neue or San Francisco in CSS

    <html><head> <style type ="text/css">body{font-family: '-apple-system','HelveticaNeue'; font-size:17;}</style> <style>body {text-align: center;}</style> </head><body> This should be <b>bold</b> text </body></html>

  • ColeXColeX Member, Xamarin Team Xamurai

    @BobWhitten said:
    Oh, I found it...

    https://stackoverflow.com/a/32410620/1758350 - Let iOS pick the System Font Helvetica Neue or San Francisco in CSS

    <html><head> <style type ="text/css">body{font-family: '-apple-system','HelveticaNeue'; font-size:17;}</style> <style>body {text-align: center;}</style> </head><body> This should be <b>bold</b> text </body></html>

    Consider accepting it as answer to help more people .

  • BobWhittenBobWhitten USMember ✭✭

    Thanks for the reminder @ColeX.
    For completeness, I also found this note about a related and still active bug: https://github.com/xamarin/Xamarin.Forms/issues/8159

Sign In or Register to comment.