summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xfakebold/latex/xfakebold.sty
blob: 51d030dedf6eeccc044fc2edd26bdd384db83364 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% $Id: xfakebold.sty 1087 2019-09-21 11:53:40Z herbert $
%%
%% This is file `xfakebold.sty', 
%%
%%   Copyright (C) 2019  Herbert Voss
%% 
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%%
\ProvidesPackage{xfakebold}[2019/09/21 v0.05 using bold characters]
\RequirePackage{ifluatex,ifxetex,xkeyval}

\def\setBold{}
\def\unsetBold{}
\def\fake@bold{0.4}%

\DeclareOptionX{bold}{%
  \def\fake@bold{#1}% 
  \ifdim\fake@bold pt > 0pt
  \else 
    \PackageWarning{fakebold}{The value must be greater than 0. Will chooose 0.3}%
    \def\fake@bold{0.3}%
  \fi}

\ProcessOptionsX
\typeout{We use fakebold with factor \fake@bold}%
\ifxetex
  \typeout{We have XeTeX}% 
  \PackageWarning{fakebold}%
  {^^J    No LuaTeX or PDFTeX running!
   ^^J    For Xe(La)TeX use the FakeBold option from package fontspec!
   \def\fake@bold{-1}}%
\else
  \ifluatex
    \def\setBold{\pdfextension literal direct { 2 Tr \fake@bold\space w }\relax}
    \def\unsetBold{\pdfextension literal direct { 0 Tr 0 w }\relax}
    \typeout{We have LuaTeX}% 
  \else
    \ifdim\fake@bold pt < \z@ \else
      \def\setBold{\pdfliteral direct { 2 Tr \fake@bold\space w }\relax}
      \def\unsetBold{\pdfliteral direct { 0 Tr 0 w }\relax}
      \typeout{We have pdfTeX}% 
    \fi
  \fi
\fi

\endinput