Google Font API: Requesting a Bold Font Style Using a Numeric Notation
If you’re a web designer who wants to take full advantage of the functionality offered by the brand new web service implemented by Google, that is the already popular Font API, then this article series might be the material that you’re looking for. It shows you how to work with the API’s most relevant features. In this ninth (and final) article of the series, you'll learn another way to get the bold version of a font.
Google Font API: Requesting a Bold Font Style Using a Numeric Notation - Downloading a bold font style via a numeric notation (Page 3 of 4 )
While it’s much more intuitive and readable to request the bold style of a font family by using the “bold” keyword or its shorthand “b,” the API will let you perform the same task by passing a number in the query string. If you’re wondering how this can be achieved, I suggest that you look at the following code fragment, which hopefully will dissipate all of your doubts:
Well, that’s not too complex to understand, right? In this case, the bold style of the “Cantarell” typeface has been downloaded by appending to the font’s name the value 700, separated by the corresponding colon. Once the request has been successfully processed, the font in question can be used in the regular way, as demonstrated by the following code snippet:
font: normal 46px 'Cantarell', Helvetica, sans-serif;
font: normal 40px 'Cantarell', Helvetica, sans-serif;
font: normal 32px 'Cantarell', Helvetica, sans-serif;
font: normal 14px 'Nobile', Helvetica, serif;
See how easy it is to use bold font styles with a numeric notation? I guess you do. Needless to say, in their current state the earlier CSS styles do nothing especially useful, since they must be included into a web page to work. That’s exactly what I plan to do in the following segment, so click on the link that appears below and keep reading.