pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Prusi <peter.pr...@gmx.de>
Subject Re: Setting base font from name as string
Date Fri, 20 May 2016 18:06:24 GMT
Exactly, I get some parameters like font name and size from a json file. 
So I dont know these at first.

Am 20.05.2016 um 19:39 schrieb Tilman Hausherr:
> But how does it come that you have a name in the first place? It is 
> normally a fixed decision to use a specific font when creating a file. 
> Or are you creating a file from parameters that are transmitted over a 
> network, e.g. in an XML file, that has these names?
>
> Tilman
>
> Am 20.05.2016 um 19:16 schrieb Peter Prusi:
>> Not exactly. In my case, I dont know which font should be used. I am 
>> getting a string which respresents the font name. For example I could 
>> make a big switch/case block:
>>
>>         switch (fontName) {
>>         case "HELVETICA":
>>             PDFont font = PDType1Font.HELVETICA;
>>             break;
>> ...
>> }
>>
>> with 14 cases, one for each available font, but I think there is a 
>> nicer way to do this :-) In 1.8 I could simply pass the font name to 
>> PDType1Font constructor, but in 2.0 I dont see this option.
>>
>>
>> Am 20.05.2016 um 18:44 schrieb Tilman Hausherr:
>>> Just use the static variables, e.g. PDType1Font.HELVETICA. Is this 
>>> what you had in mind?
>>>
>>> Tilman
>>>
>>> Am 20.05.2016 um 18:42 schrieb Peter Prusi:
>>>> No, I like to use one of the 14 fonts defined in PDType1Font class. 
>>>> In version 1.8 it was possible to pass a font name to the 
>>>> PDType1Font constructor (PDType1Font(String baseFont)) to create a 
>>>> PDType1Font object with given name. In version 2.0 this constructor 
>>>> is private. In 1.8 I see also a function getStandardFont(String 
>>>> name), which returns the PDType1Font object with the passed string.
>>>>
>>>> I am looking for something like this in version 2.0.
>>>>
>>>> Am 20.05.2016 um 17:27 schrieb Tilman Hausherr:
>>>>> Am 20.05.2016 um 15:41 schrieb Peter Prusinowski:
>>>>>> Hello,
>>>>>>
>>>>>> I am trying set a base font from its name as string. In 
>>>>>> PDType1Font class, there is a constructor for this purpose: 
>>>>>> PDType1Font(String baseFont), but only private accessible.
>>>>>> I also tried with FontMappers class without success. Can anyone 
>>>>>> help me ?
>>>>>
>>>>> Could you clarify what you mean with "set a base font from its 
>>>>> name as string"?
>>>>>
>>>>> Do you want to use an external font?
>>>>>
>>>>> Tilman
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message