Edit online

Some fonts do not have a bold or italic variant, and Oxygen PDF Chemistry automatically falls back to the regular font. This topic demonstrates how to instruct Oxygen PDF Chemistry to synthesize font variants. Do not use this technique if you have all the font components.

Using a Simulated Styles Font from a True Type File (ttf)

Suppose you plan to style the output with the Raleway font and you just have the Raleway-Regular.ttf font available. The regular font face definition will be:

@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 400; /* normal */
  src: url("fonts/raleway/Raleway-Regular.ttf");
}
For the missing style combinations, this example uses the -oxy-simulate-style: yes CSS extension property.
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 700; /* bold */
  -oxy-simulate-style: yes;  
  src: url("fonts/raleway/Raleway-Regular.ttf");
}
@font-face {
  font-family: "Raleway";
  font-style: italic;
  font-weight: 400; /* normal */
  -oxy-simulate-style: yes;  
  src: url("fonts/raleway/Raleway-Regular.ttf");
}
@font-face {
  font-family: "Raleway";
  font-style: italic;
  font-weight: 700; /*bold*/
  -oxy-simulate-style: yes;
  src: url("fonts/raleway/Raleway-Regular.ttf");
}

Using a Simulated Font Style from a True Type Font Collection (ttc)

Chemistry Limitation:

The @font-face rules in your CSS work as expected when they are pointing to a .ttf file. If you intend to use a .ttc collection, the value of the font-family property should match exactly one of the font names from the collection (a collection contains multiple fonts).

The following example uses the Microsoft JhengHei font (the msjh.ttc). Many of the Chinese fonts provide regular, light, bold, but no italic or bold-italic variants. In this case, you may want Oxygen PDF Chemistry to generate the missing variants for you.

To use the regular variant, use a simple @font-face definition, making sure the font family is found in the collection:

@font-face {
  font-family: "Microsoft JhengHei";
  font-style: normal;
  font-weight: 400;
  src: url("fonts/jenghei/msjh.ttc");
}

For the missing style combinations, the example uses the -oxy-simulate-style: yes CSS extension property.

@font-face {
  font-family: "Microsoft JhengHei";
  font-style: normal;
  font-weight: 700;
  -oxy-simulate-style: yes;
  src: url("fonts/jenghei/msjh.ttc");
}
@font-face {
  font-family: "Microsoft JhengHei";
  font-style: italic;
  font-weight: 400;
  -oxy-simulate-style: yes;
  src: url("fonts/jenghei/msjh.ttc");
}
@font-face {
  font-family: "Microsoft JhengHei";
  font-style: italic;
  font-weight: 700;
  -oxy-simulate-style: yes;
  src: url("fonts/jenghei/msjh.ttc");
}
@font-face {
  font-family: "Microsoft JhengHei";
  font-style: normal;
  font-weight: 100;
  -oxy-simulate-style: yes;
  src: url("fonts/jenghei/msjh.ttc");
}