Print Euro symbol

Discussion in 'MATLAB' started by Thomas, Aug 17, 2007.

  1. Thomas

    Thomas Guest

    Hello,

    does anybody know how to include an Euro symbol ('€') in a
    figure and print it on a postscript printer?

    Best regards
    Thomas
     
    Thomas, Aug 17, 2007
    #1
    1. Advertisements

  2. Thomas

    us Guest

    Thomas:
    <SNIP a european...

    one of the solutions

    eu=sprintf('%c',8364);
    line(0:1,0:1);
    title(eu,...
    'fontsize',32,...
    'fontname','arial');
    text(.1,.5,eu,...
    'fontsize',64,...
    'fontname','courier new');

    us
     
    us, Aug 17, 2007
    #2
    1. Advertisements

  3. Thomas

    Thomas Guest

    Thank you for your prompt answer.
    Your solution works when I print the figure directly in
    verbose mode. Though, it fails when I try to print it
    (figure handle fh) to a file using

    print(fh,'-dpsc2','test.ps');

    After distilling it to PDF the Euro symbol is gone. Any
    idea how could this be solved?
     
    Thomas, Aug 17, 2007
    #3
  4. Thomas

    Thomas Guest

    Finally, I found a solution by switching to symbol font.

    To get a PDF with a figure containing the string "Less than
    10€ per piece." the following code could be used:

    % --------------------------
    fh = figure;
    text(fh,0.5,0.5,strcat('Less than 10\fontname{Symbol}',char
    (160),'\fontname{Helvetica}per piece.');
    print(fh,'-dpsc2','test.ps');
    % --------------------------

    Finally, the postscript file "test.ps" needs to be
    distilled to PDF.

    The '€' symbol will not be displayed in the MATLAB figure
    but it will show up in the PDF.

    (The archaic printer driver functions of MATLAB are
    hopelessly outdated. The use of Unicode encoding and system
    available fonts in graphics is standard elsewhere.)
     
    Thomas, Aug 18, 2007
    #4
  5. Hello,
    I am using Matlab running on a Linux OS and the tips you gave don't seem to work :-(
    I want to get the euro symbol on a figure (ylabel and xlabel) and I want to save this figure as a pdf file.
    Which command should I use ?

    Thank you
     
    Franck Bourry, Oct 13, 2009
    #5
  6. Thomas

    Thomas Guest

    Hi Franck,

    for my system (MS Windows XP) and my pdf-font the ASCII code for the "Euro"-symbol is 160. For you it might be a different one.

    In order to find out about it you might try the following code at first:

    % --------------------------
    fh = figure;
    for i=1:4
    for j=1:32
    t = 128 + (i-1)*32+j;
    text((i-1)*0.25,1-(j-1)/32,['char(' num2str(t) ') = ' char(t)],'FontName','Symbol','FontSize',10);
    end
    end
    print(fh,'-dpsc2','charset.ps');
    % --------------------------

    I suggest you identify the ASCII-code for the "Euro"-symbol in the figure both on the screen and in the resulting file "charset.ps" (after you distilled it to "charset.pdf"). Just replace the number 160 in the code I posted earlier with the one you found and it should work.
     
    Thomas, Nov 13, 2009
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.