ios - UIWebView, simply select "actual" font in css, not just family? -


in ios, using uiwebview, load short text file , display in uiwebview. (loadhtmlstring)

<html><head><style type='text/css'> body { font-family:'source sans pro'; font-size:12pt; } html { -webkit-text-size-adjust:none; } </style></head> <body leftmargin=0 topmargin=0> example text... </body></html> 

here 12 "actual" font names installed (print(uifont.fontnamesforfamilyname("source sans pro")))

["sourcesanspro-boldit", "sourcesanspro-semiboldit", "sourcesanspro-extralight", "sourcesanspro-semibold", "sourcesanspro-bold", "sourcesanspro-black", "sourcesanspro-regular", "sourcesanspro-light", "sourcesanspro-blackit", "sourcesanspro-it", "sourcesanspro-extralightit", "sourcesanspro-lightit"]

now in uiwebview

body { font-family:'source sans pro'; font-size:12pt; } 

that works perfectly; regular source sans pro font appears.

but. quite simply,how hell tell css use "extralight", "blackit" , on?

how choose specific 1 of 12 fonts???

help!

you have use actual font names in css:

<html>     <head>         <style type='text/css'>             body {                 margin: 30px;                 font-family: 'sourcesanspro-regular';                 font-size: 12pt;             }             h1 {                 font-family: 'sourcesanspro-black';                 font-size: 16pt;                 font-weight: normal             }             .light {                 font-family: 'sourcesanspro-extralight';             }         </style>     </head>     <body>         <h1>header</h1>         <p>normal text</p>         <p class="light">light text</p>     </body> </html> 

enter image description here

one side note: when work fonts provide 'real' bold font face idea remove 'artificial' bold font-weight makes bold font bolder ugly. (that's why added font-weight: normal h1 selector)


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -