[Dev-luatex] Snapshot 20070202

Hans Hagen pragma at wxs.nl
Sat Feb 3 21:19:57 CET 2007


Arthur Reutenauer wrote:
>> * But the big news is that you can now define your own virtual fonts
>>    on the fly, by adding a few statements to the table returned to
>>    the 'define_font' callback.
>>     
>
>   Brilliant! That's simply great...
>   
how about this one then

    f = fonts.tfm.read('ec-lmr10',area,size)
    if f then
        f.name = name
        f.type = 'virtual'
        f.fonts = {
            {'ec-lmr10' , size},
            {'ec-lmss10', size},
            {'ec-lmtt10', size}
        }
        for i,v in pairs(f.characters) do
            if i and v then
                local chr = string.char(i)
                if chr:find("[A-Z]") then
                    v.commands = {
                        {'special','pdf: 1 0 0 rg'},
                        {'font',2},
                        {'char',i},
                        {'special','pdf: 0 g'},
                    }
                elseif chr:find("[0-9]") then
                    v.commands = {
                        {'special','pdf: 0 0 1 rg'},
                        {'font',3},
                        {'char',i},
                        {'special','pdf: 0 g'},
                    }
                else
                    v.commands = {
                        {'font',1},
                        {'char',i},
                    }
                end
            end
            if i == 255 then break end
        end
    end

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the dev-luatex mailing list