[changeset] fontsize with fontname="*" (was: Octave 3.1.55: printing to pdf)

Ben Abbott bpabbott at mac.com
Mon Apr 6 18:04:51 CDT 2009


On Apr 6, 2009, at 4:14 PM, Ben Abbott wrote:

>
> On Apr 6, 2009, at 11:40 AM, Ben Abbott wrote:
>
>> On Apr 5, 2009, at 2:58 PM, Ben Abbott wrote:
>>
>>> On Apr 5, 2009, at 2:14 PM, Ethan A Merritt wrote:
>>>
>>>> On Sunday 05 April 2009, Ben Abbott wrote:
>>>>>
>>>>> On Apr 5, 2009, at 3:47 AM, Petr Mikulik wrote:
>>>>>
>>>>>> Printing to pdf (via gnuplot backend) is broken in Octave 3.1.55
>>>>>> even though
>>>>>> gnuplot accepts "set term pdf" via "pdfcairo" terminal.
>>>>>>
>>>>>>> plot(1:100); print a.pdf -dpdf
>>>>>>
>>>>>> error: gnuplot_drawnow: the gnuplot terminal, "pdf", is not  
>>>>>> available.
>>>>>> error: called from:
>>>>>> error:
>>>>>> /opt/octave/octave-3.1.55/share/octave/3.1.55/m/plot/
>>>>>> gnuplot_drawnow.m at
>>>>>> line 72, column 7
>>>>>>
>>>>>> It seems that gnuplot_drawnow.m requires exact match of terminal
>>>>>> names in
>>>>>> 3.1.55. However, gnuplot names the pdf terminal "pdf" or  
>>>>>> "pdfcairo"
>>>>>> according to the library it was compiled against. In both cases  
>>>>>> "set
>>>>>> term
>>>>>> pdf" works.
>>>>>>
>>>>>> I think gnuplot_drawnow.m should test presence of "pdfcairo" if
>>>>>> "pdf" has
>>>>>> not been found.
>>>>>>
>>>>>> If I try
>>>>>> 	print zz.png -dpngcairo
>>>>>> 	print zz.pdf -dpdfcairo
>>>>>> it produces these two files:
>>>>>> 	pngcairo:zz.png
>>>>>> 	pdfcairo:zz.pdf
>>>>>> Why the prefix there?
>>>>>>
>>>>>> ---
>>>>>> PM
>>>>>
>>>>> Petr,
>>>>>
>>>>> For "set term png" if there is no "png" present does gnuplot
>>>>> substitute "pngcairo" as well?
>>>>
>>>> yes
>>>>
>>>>> I notice the cairo terminals default options are different from  
>>>>> the
>>>>> non-cairo terminals. Specifically, there is no default font-name
>>>>> specified, in GPVAL_TERMOPTIONS, for the cairo terminals. This  
>>>>> will
>>>>> interfere with the rendering of different font-sizes when the
>>>>> anonymous font-name "*" is associated to an Octave text object.
>>>>
>>>> The cairo terminals default to font "Sans".
>>>> Why does this make a difference?
>>>
>>> Octave would prefer to specify the font-name and font-size for all  
>>> text objects. Unfortunately, Octave has no way to determining that  
>>> font-names are available to a particular gnuplot terminal. If a  
>>> font-name is specified that a terminal does not have access to,  
>>> errors/warnings result. In addition, the text generally does not  
>>> show up.
>>>
>>> To alleviate this, the current implementation of Octave uses an  
>>> anonymous default font-name, "*". When this anonymous font-name is  
>>> associated with a text object,  neither the font-name or font-size  
>>> are passed on to gnuplot. The exceptions to this are the x11 and  
>>> wxt terminals which apparently have no problem with the fontname  
>>> "*".
>>>
>>>> Would you like this to be echoed back by "show term"?
>>>> All gnuplot terminals should accept a font-size request with a  
>>>> blank font
>>>> name as referring to the current (perhaps default) font.
>>>> E.g.
>>>>  set term png enhanced font ",11"
>>>>  set title "Big Title" font ",20"
>>>> should give you the default font in size 11 points, and a title  
>>>> in the
>>>> same font with size 20 points.
>>>
>>> Ok! I'll prepare a changeset to fix how Octave handles a font-name  
>>> of "*".
>>>
>>> Thanks for the information. This will simplify things quite a bit.
>>>
>>> Ben
>>
>>
>> I've attached a changeset that permits the text associated with a  
>> "fontsize" property to rendered as desired when the fontname  
>> property is set to the anonymous name "*".
>>
>> I ran "rundemos plot" with gnuplot-4.2.4 and gnuplot-4.3.0 (recent  
>> copy). I encountered no problems.
>>
>> I'll push this change later today.
>>
>> Ben
>>
>> <changeset-fontsize.patch>
>
> I missed changing __go_draw_figure.m
>
> New changeset attached.
>
> Ben
>
>
> <changeset-fontsize.patch>

This change has been pushed.

Ben



More information about the Octave-maintainers mailing list