need help with upper scrip

Posted by: Sami786

need help with upper scrip - 07/24/20 01:32 PM

happy Friday all,

Can someone help me how to print French upper script

Example I need to print "ier" and "eme" in upper script
1ier Juillet 2020
22eme Jullet 2020

Thank you
Posted by: jim3108

Re: need help with upper scrip - 07/27/20 07:53 AM

If you want to make anything uppercase in Design, use the uppercase function which is available here: Click here.

However in your case, you could just target the 'ier' and 'eme' with stringreplace as follows:

Code:
=stringreplace(&MyVar, 'eme', 'EME')

Let us know how you get on.

Regards,

James.
Posted by: Sami786

Re: need help with upper scrip - 07/27/20 04:14 PM

Hi Jim,

What I need is not upper case, I need to print the 1(ier) in small font and a little upper as Cardinal date.

Example “Le 1ier juin 1943”.

22nd April 2020 the (nd) should be printed in small script font and upper.
Posted by: jim3108

Re: need help with upper scrip - 07/27/20 06:44 PM

I believe you are referring to superscript.

Please refer to Raphael's post here.
Posted by: Sami786

Re: need help with upper scrip - 07/29/20 03:58 PM

I tried Raphael's post but it's not wrapping for me

I created the function as below:
function @Superscript(&super:string, &x:measure, &y:measure)
SetStyle(&Helvetica6)
moveto(&x, &y - 0.06)
show(&super)
moveto(&x, &y)
endfunction()

----------------------
Then I used a Text object and copied below Prestalk code


setstyle(&Default)
beginparagraph(0,6,0,'left',0.1598)
show(trim(@(12,1,2)))
endparagraph

@SuperScript('ier', &current.x, &current.y)
setstyle(&Default)
rmoveto(0, -0.1598)

beginparagraph(0,6,&current.x,'left',0.1598)
show(trim(@(12,3,20)))
endparagraph

The idea was to split the date in two blocks of code, and call the superscript function in between, and use & current.x as the first indentation of the second paragraph. I tested this code with both Helvetica but it's not wrapping, the superscript (ier) is static and not wrapping correctly.

I need to print
1ierjuin 1973
29iemejuin 2020


Posted by: Philippe F.

Re: need help with upper scrip - 07/30/20 09:51 AM

You were close. There are two tricks here:
  • Your second paragraph must be moved up by one line because a paragraph always starts on a new line.
  • The second paragraph must have the same properties as the first one with the exception of its first indent property, which must be set to the current X position.

  • beginparagraph(0,3,0,'left',0.1598)
      setstyle(&Style1)
      show('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat 1')
    endparagraph
    
    @SuperScript('ier')
    
    %% MOVE UP ONE LINE BEFORE THE NEXT PARAGRAPH
    rmoveto(0,-0.16)
    
    %% SET FIRST INDENT TO &current.x
    beginparagraph(0,3,&current.x,'left',0.1598)
      setstyle(&Style1)
      show(' juin 1973 aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.')
    endparagraph
    
    setstyle(&Style1)
    

Note that you SuperScript function should be simplified since it doesn't require any X,Y parameters:

    function @SuperScript(&sp:string)
      rmoveto(0,-0.06)
      setstyle(&Super)
      show(&sp)
      rmoveto(0,0.06)
    endfunction()
    
Posted by: Sami786

Re: need help with upper scrip - 08/03/20 10:03 PM

it's printing correctly if there's one digit

1ierjuin 1973 prints correctly

29iemejuin 2020 print incorrectly it's not wrapping correctly when two digits!
Posted by: Philippe F.

Re: need help with upper scrip - 08/04/20 07:26 AM

I just tested the script again with several different values (even ludicrous ones like "2439 juillet 2020"!) and it still works just fine.

When you say it doesn't "wrap" properly, do you mean that the entire date remains on the same line? Are you sure you are adding spaces before and after each part of the date? (without spaces, the text cannot wrap properly).
Posted by: Sami786

Re: need help with upper scrip - 08/20/20 01:26 PM

Thank you, it's working by adding the space smile