Fonts: Hosting a Font on Your Website - ROES Web
Add a Lab-Hosted Font for ROES Web
Use this article to host a font file and CSS file for ROES Web, import the CSS into the ROES Web override CSS, and verify that CORS and MIME settings allow the font to load.
Before You Begin
If you already own a font, use Font Squirrel to generate CSS and convert the font to a webfont: Font Squirrel Webfont Generator.
Do not use fonts unless the lab has the right to use and host them.
Add the Lab-Hosted Font
Add the font file to the website or server
Upload the font file to the lab website or server. Font format may be TrueType (.ttf) or Web Open Font Format (.woff / .woff2).
Example font file
Record the font URL
Record the URL to the hosted font file.
Create the font CSS file
Create a .css file that contains the source URL to the font and the format type. Format values include truetype, embedded-opentype, woff, and woff2.
Add a @font-face section to the CSS file for each font-weight and font-style you want to support.
Upload the CSS file
Upload the modified CSS file to the lab website or server.
Import the font CSS into the ROES Web override CSS
Add an @import statement to the ROES Web Client overriding CSS file, then save and upload it.
Verify the Font Loads in Chrome
Open ROES Web and Inspect
Open Chrome, go to the ROES Web Client, right-click the page, and choose Inspect.
Clear the web cache and open Sources
Clear the web cache, select Sources from the top toolbar, and find the cloud icon that has the website URL.
Confirm the font folder exists
Expand the website section, drill down to the location where the font and CSS files are stored, and verify that the font folder exists.
Important ROES Server Font Requirement
Any font added to the ROES Web Client must also be installed on the computer or computers running ROES Server.
Render a template that uses the font in text to verify the added font supports bold or italics. Verify the font displays in ROES Web exactly as it renders in ROES Server. If there is a mismatch, the font may not be usable.
CORS and Server Access
Be sure the web server allows access to hosted fonts and satisfies CORS, or Cross-Origin Resource Sharing. This may require a change in the .htaccess file and/or MIME types.
S3 Settings
.htaccess File
Modify the .htaccess file, usually found in the website root directory, such as the public_html .htaccess file.
Apache config limited to font file extensions
Adds more file type extensions, including CSS and JS
Limits sharing to one website
Sharing for multiple websites
This example also checks whether the mod_headers module is enabled on Apache.
Header Check
To ensure the header is set properly, check with the curl utility.
Example Result
Header Check 2
This command returns only the header value needed for the font CORS check.
Expected Result
In either check, if you see Access-Control-Allow-Origin: * in the response, the CORS header is set correctly.
MIME Types
To set MIME types for font files, add one or more of these lines to the server configuration.
Expected Result
The hosted font and CSS should load in ROES Web, Chrome Sources should show the hosted font location, and the server should return the required CORS header for the font files.
Helpful Link
Font Squirrel Webfont Generator
Escalation Notes
- Confirm the lab has permission to use and host the font.
- Confirm the font file and CSS file are reachable by URL.
- Confirm the ROES Web override CSS imports the hosted font CSS.
- Confirm the font is installed on the ROES Server computer or computers.
- Confirm the font renders the same in ROES Web and ROES Server, including bold or italic variants if used.
- Confirm the web server returns Access-Control-Allow-Origin and the correct font MIME types.