summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty
blob: dec982e702cf91abcfd27ca7c89e74468a50f997 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
%
% anyfontsize.sty -- allow font size substitutions
% by Péter Szabó <pts@fazekas.hu> at Sat Feb  3 13:56:49 CET 2007
%
% anyfontsize.sty is a LaTeX2e package that lets the user select any font
% size (via e.g. \fontsize{...}{...}\selectfont), even those sizes that are
% not listed in the .fd file. If such a size is requested, LaTeX will search
% the nearest listed size, and anyfontsize.sty will scale that font to the
% requested size. For a similar functionality that works only for the CM
% fonts, try the type1cm.sty package, or, even better, use the new Latin
% Modern (LM) fonts, which are available at any size.
%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% 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.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%
%
% For PostScript Type1 fonts (such as Times (with times.sty) or Latin Modern
% (with lmodern.sty)), you usually don't need anyfontsize.sty, because these
% fonts are available at all sizes.
%
% anyfontsize.sty doesn't work well with pdfLaTeX + the EC fonts (because
% pdfTeX won't regenarate missing PK fonts for you). Compile the document
% with latex(1) first (which will regenarte the missing PK fonts), and after
% that you can use pdflatex(1).
%
% Test with this document:
%
%   \documentclass{article}
%   \usepackage{anyfontsize}
%   \usepackage{t1enc}
%   %\input t1cmr.fd
%   %\DeclareFontFamily{T1}{cmr}{}
%   %\DeclareFontShape{T1}{cmr}{m}{n}{<10>ecrm1000}{}
%   \begin{document}
%   \fontsize{23}{28}\selectfont foo
%   \end{document}
%
% History:
%
% -- 2007/02/04: original release
% -- 2007/11/22: added space bugfix, as suggested by Christian Schroeppel
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{anyfontsize}[2007/11/22 anyfontsize.sty by pts]

%** Don't warn on font substitutions made.
\def\fontsubfuzz{9999pt}

% vvv Dat: only for testing
%\input t1cmr.fd
%\DeclareFontFamily{T1}{cmr}{}
%\DeclareFontShape{T1}{cmr}{m}{n}{<10>ecrm1000}{}

%** Overrides \externalfont by specifying the ` at <requested-fontsize>pt'
%** clause. The requested font size is in \f@user@size.
\def\anyfontsize@set#1 #2\hfuzz{%
  \@tempdimb=\f@user@size\p@%
  \edef\external@font{#1 at\the\@tempdimb}%
}%

%** Overrides definition in latex.ltx
%** See %%%% pts %%%% for the overridden part.
\gdef\tryif@simple#1-#2\tryif@simple{%
  \let \reserved@f \try@simples
  \if>#2%
    \dimen@ #1\p@
    \ifdim \dimen@<\@M\p@
      \ifdim \f@size\p@<\dimen@
        \@tempdimc \dimen@     
        \advance\@tempdimc -\f@size\p@
      \else                           
        \@tempdimc \f@size\p@
        \advance\@tempdimc -\dimen@
      \fi                          
      \ifdim \@tempdimc<\@tempdimb
        \@tempdimb \@tempdimc     
        \def \best@size{#1}% 
      \fi                   
    \else
  \ifx \external@font\@empty
    \ifx \best@size\@empty  
    \else                 
      \ifdim \@tempdimb>\font@submax \relax
        \xdef \font@submax {\the\@tempdimb}%
      \fi                                   
      \let \f@user@size \f@size
      \let \f@size \best@size  
      \ifdim \@tempdimb>\fontsubfuzz\relax
        \@font@warning{Font\space shape\space
            `\curr@fontshape'\space in\space size\space
             <\f@user@size>\space not\space available\MessageBreak
             size\space <\f@size>\space substituted}%             
      \fi                                            
      \try@simple@size
      %
      %%%% pts %%%%
      \expandafter\anyfontsize@set\external@font\hfuzz
      %      
      \do@subst@correction
    \fi                   
 \fi
      \let \reserved@f \remove@to@nnil
    \fi                               
  \fi
  \reserved@f}

\endinput