Specifying standard fonts for CasperJS / PhantomJS on Debian

We are trying to tell which fonts to use CasperJS / PhantomJS when it finds a generic css-serif css font. We tried to modify the ~ / .fonts.conf file, but it is completely ignored.

Is it possible to tell CasperJS / PhantomJS which font to use while also specifying fallback fonts for different character sets (e.g. Chinese, Japanese, Korean, etc.)?

+3


source to share


1 answer


You can use any font by linking to it in the CSS file. I use the following for Russian:

@font-face {
    font-family: 'open_sanslight';
    src: url('cyrillic/opensans-light.svg#open_sanslight') format('svg');
    font-weight: normal;
    font-style: normal;
}

      

Then you can set the font as the default font for your HTML document or specific areas. Once the font is defined, set it as the default font for the entire document as follows:

body {
  font-family: open_sanslight;
}

      



Complete example:

<!DOCTYPE html>
<html>

    <head>
    <style>
        @font-face {
            font-family: 'open_sanslight';
            src: url('cyrillic/opensans-light.svg#open_sanslight') format('svg');
            font-weight: normal;
            font-style: normal;
        }

        body {
          font-family: open_sanslight;
        }
    </style>
    </head>

    <body>
      <h1>This is a heading</h1>
      <p>This is a paragraph.</p>
    </body>

</html>

      

This requires a .svg file in the folder cyrillic

. You can download these files (or others) from Google Fonts .

-1


source







All Articles