forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

print special characters
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Bartl



Joined: 16 Oct 2009
Posts: 58
Location: München

PostPosted: Fri Jun 01, 2012 2:12 pm    Post subject: print special characters Reply with quote

Hello,
special characters on screen works fine, how to print special characters?

Code:

WINAPP
IMPLICIT NONE
INCLUDE <windows.ins>
INTEGER*4 i,w
character*80 s(4)
integer*4 k,j
integer hnd1
data hnd1/1/
s(1) = '{sum n=1;{infinity}}{divide l;n{sup 2}}={divide {pi}{sup 2};6}'
i = winio@('%ca[Equatation]%bg[grey]&')
w = winio@('%ob%eq@%cb&',s(1),200,100)
w = winio@(' ')
k=open_printer@(hnd1)
j=select_graphics_object@(hnd1)
call size_in_points@(6,6)
call draw_characters@(s(1),1000,2000,rgb@(255,0,0))
k=close_printer@(hnd1)
end


Many thanks
Johann
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Jun 01, 2012 5:19 pm    Post subject: Reply with quote

1. Capture from screen as a graphic, and paste that onto the page (which is already in graphics mode). If it is always the same thing that you print, then consider creating a bitmap and including it in your Resources.
2. Select the Symbol font, and by judicious choice of position and character size generate your equation.
3. Create your own font and use that - some applications have their own maths fonts that you might be able to use.
4. Open printer for use with html ('html_printer_open') and put your equation in between <equation> and </equation> tags. HTML is useful because you have access to different character sizes, bold, italic, underlining etc from ordinary Fortran formatted writes.

I'm sure that this isn't a complete list.

Eddie
Back to top
View user's profile Send private message
Bartl



Joined: 16 Oct 2009
Posts: 58
Location: München

PostPosted: Mon Jun 04, 2012 7:50 am    Post subject: Reply with quote

Hallo Eddie,
how to change the size and exact position of the "sigma" character?
It should have the same size und vertical location like the word "result".
call size_in_pixel and call size_in_points does'nt work.
thanks
Johann
Code:

WINAPP
IMPLICIT NONE
INCLUDE <windows.ins>
INTEGER*4 i
character*80 s(1)
s(1) = '{sigma}'
i = winio@('%ca[Equatation]%bg[grey]%fn[arial]&')
!  call size_in_points@(0,0)
!  call SIZE_IN_PIXELS@( 200,200 )
i = winio@('%tsresult &',1.0D0)
i = winio@('%eq@&',s(1),20,20)
i = winio@('%sdx,Rd%`sd&')
i = winio@('%ts [N/mm2]&',1.0D0)
i = winio@(' ')
end
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Jun 04, 2012 8:46 am    Post subject: Reply with quote

I am not sure what you want but it may be easier like this

Code:
WINAPP
IMPLICIT NONE
INCLUDE <windows.ins>
INTEGER*4 i
character*80 s(1)
s(1) = '{sigma}'
i = winio@('%ca[Equatation]%bg[grey]%fn[arial]&')
!  call size_in_points@(0,0)
!  call SIZE_IN_PIXELS@( 200,200 )
i = winio@('%tsresult &',1.0D0)
!i = winio@('%eq@&',s(1),20,20)
i = winio@('%fn[Symbol]s%sf&')
i = winio@('%sdx,Rd%`sd&')
i = winio@('%ts [N/mm2]&',1.0D0)
i = winio@(' ')
end
Back to top
View user's profile Send private message AIM Address
Bartl



Joined: 16 Oct 2009
Posts: 58
Location: München

PostPosted: Mon Jun 04, 2012 9:33 am    Post subject: Reply with quote

Thank you very much, it's exact what I mean, so easy when you know it.
It would be great, if you could give me a easy example like this to print this line on a printer.

Johann
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Mon Jun 04, 2012 2:35 pm    Post subject: Reply with quote

Paul has modified your code to use my suggestion 2 above. Those Clearwin format codes work on your screen windows. To get the same thing on your printer, you need to open the graohics printer either by having a standard callback (say from a button) of 'PRINTER_OPEN' or 'PRINTER_OPEN1' or 'GPRINTER_OPEN', or by using one of the subroutines in the library OPEN_PRINTER@ etc. Then you go through the process of constructing your graphic part by part using the subroutines in the graphics part of the library. You will certainly want SELECT_FONT@, and probably you will get a better result by using SIZE_IN_POINTS@ than in pixels (it is the other way round on the screen in a %gr area. If you have selected the Symbol font you will get Greek characters when you write ordinary text using CALL DRAW_CHARACTERS@.

Eddie
Back to top
View user's profile Send private message
Bartl



Joined: 16 Oct 2009
Posts: 58
Location: München

PostPosted: Tue Jun 05, 2012 1:40 pm    Post subject: Reply with quote

Hello,
now I understand and both, screen and printer work fine with special characters.

Tank you very much for your great and quick help.

Johann
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Wed Jun 06, 2012 9:37 pm    Post subject: Reply with quote

Paul, i think this still needs some fine tuning for positioning of subscripts and specifically superscripts which look very ugly. Look at the code

Code:
 character*80 s(1)
 s(1) = '{sigma}'
 i = winio@('%ca[Equatation]%bg[grey]%fn[arial]&')
 i = winio@('%ts&',1.0D0)
 i = winio@('where %fn[Symbol]s%sf&')
 i = winio@('%sdx%`sd&')
 i = winio@('%su1/2%`su represents%ff&')

 i = winio@('where %fn[Symbol]s%sf&')
 i = winio@('%su1/2%`su&')
 i = winio@('%sdx%`sd represents%ff&')

 i = winio@('where  %sfa%sf&')
 i = winio@('%su1/2%`su&')
 i = winio@('%sdx%`sd represents')


 end
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Thu Jun 07, 2012 7:18 am    Post subject: Reply with quote

I can look at this but this kind of thing is very tricky. Anything I do in this kind of area can easily break someone's work-around.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Jun 08, 2012 6:36 am    Post subject: Reply with quote

Hi Paul,

You don't break the workaround if you introduce new format codes to set sizes of equation characters and sub/super script offsets, but keep the default behaviour as is. (Or a format code that implies 'equations in new style'). Whether or not this is a priority I cannot judge, but suspect that it is not.

Eddie
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Jun 08, 2012 7:10 am    Post subject: Reply with quote

Introducing new two-letter codes makes Clearwin less and less intuitive to read. It would be better to make new three-letter Clearwin++ which gives more freedom to stay less cryptic lexically
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Jun 08, 2012 4:30 pm    Post subject: Reply with quote

Dan,

I don't agree. All Clearwin today is done with 2 letter codes, and changing this is a problem. Whether or not Clearwin should have used 3 or more ab initio is a debate to which there is no answer, but a 1 letter 'sequence' gives definitely too few possibilities, and the 26x26 two-letter combinations produces vastly more codes than seem to be needed - and it is not possible to visit 'alternative history' at this point.

There are many alternatives to a %?? format code, and they include:

    a subroutine call
    an additional parameter in the options list for %ww or %sy
    a modifier such as ` which has not been used


There aren't many Clearwin codes that are not generally mnemonic for a native English speaker (home territory to Clearwin!) although I do keep wanting to use %fs as "font size" instead of its real purpose after using %fn.

However, the general principle of not wanting to break anything is a good one, which is why I often dissent from some of the 'future Fortran' proposals to declare something obsolete, and get frustrated by some of the changes to Windows (see other posts, including re GET_FILTERED_FILE@). One of the benefits of Fortran is the ability to use code written a long time ago, and I still regularly use code I wrote in 1970 (and every year since, with few exceptions).

Regards

Eddie
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Jun 08, 2012 9:43 pm    Post subject: Reply with quote

Eddie,

First, this is not a Fortran, Fortran means simplicity, not overcrypting. Here despite most of codes are very good abbreviations from English you still have to rely on your memory to cut the options.

If this was Fortran it would be dead long ago due to its almost encrypted nature. It is literally impossible to remember all the two-letter codes. Better to say - well, you may memorize them when you heavily programming in Clearwin, but then you get 2-3 years interruption while using them very occasionally and then guess what? You start over looking into help. I've done that 3-4 times ! The codes always leave too much guessing. I was using CWP for 15 years, my couple codes have 30+ thousand of CWP codes each and i still very often look into the help to make sure that's the right code.

Other GUI builders took another more verbose approach which is kind of opposite corner. Their functions may have very many letters. Winteracter for example. People when they have very large codes tend to use larger variables which perfectly serves the purpose of self-documenting. Look at Linux sources - they sometimes use 63 character variables! And that's the key psychological point. We will not lose too much if we will type a bit more. We will not forget passwords if it is very long but very logical - we will forget them it will be short 6-8 numbo-letter soup. I am glad by the way that FTN95 is probably the only Fortran compiler which allows superlong variables much longer then 31 letter, i am very happy developers made it and use them permanently lately.

From the point of simplicity having too short codes is actually not a gain but a loss in readability. I hope that making at least three-letter codes will allow Clearwin+ to be expanded an additional order of magnitude not losing readability and "memorability".

I was making this list just as an example for all to look and found myself looking into help for 3/4 of them JUST TO MAKE SURE i do not mix them with something else! I marked some codes which clearly gain readability with the stars, and added minus when 2-letter codes look better. I guess sometimes third letter could be a number to make an options for 2-letter codes. The ptoposed abbreviations could be improved to be more close to natural English words we use for that specific purpose. Clearly some current two-letter codes run out of steam to find best equivalent. And with time things will be even worse - imagine 5 times more codes - it will be end of the game.

In short - three letter codes leave you with much less guessing what they are, they could be more systematically grouped, and they allow further natural language expansion of Clearwin+ to Clearwin+++++. Smile

%ac - %acc accelerator
%ap - %abp absolute position
%aw - %acw attach child window
%bc - %bco or %btc button color
%bd - %brd borders
%bf - %bfn or %bld bold font
%bg - %bgc background color (for everything else) **
%bh - %bbh bubble help
%bi - %bic button icon
%bk - %rmb right mouse button **
%bm - %bmp bitmap -
%br - %bar bar *
%bt - %btn button *
%bv - %tre tree view *
%bx - %box box *
%ca - %cap caption *
%ob - %obx open box
%cb - %cbx close box
%cc - %ccw Control Closure of Window
%ch - %chw child window
%cl - %pal palette colors **
%cn - %cnt center text
%co - %cob control box of %rd, %rf *
%cu - %cur cursor shape
%cv - %ctr control variable
%cw - %cww Clearwin Window
%dc - %dfc default cursor
%dd - %spi spin wheel Integer *
%df - %spf spin window flating point
%de - %daw disable windows *
%dl - %rpt repeating call of windows *
%dr - %drp drop file
%dw - %dgb draw graphics box
%dy - %mvy move in y direction
%eb - %ebx edit box
%el - %ecb edit combo box
%eq - %eqn equation **
%es - %esc esc
%ew - %exw exit Windows
%fb - %fnb font for buttons *
%fd - %fn5 font for Win95
%ff - %ffd form feed -
%fh - %fnW font from Windows **
%fl - %fpl FP limits ***
%fn - %fnt font **
%fr - %frm frame **
%fs - %dir directory to save *
%ft - %flt filter text *
%ga - %grb or %gar


Last edited by DanRRight on Sat Jun 09, 2012 5:30 am; edited 2 times in total
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat Jun 09, 2012 12:35 am    Post subject: Reply with quote

Dan,

The 3-letter codes won't happen, as there look to be far more pressing issues. I will reserve my judgement on what you have said here - but 2 letters is enough for me. Like you, I have to frequently revisit help. If you don't use Plato, the help for Clearwin is lots of clicks away - it is much more convenient in Plato.

Eddie
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sat Jun 09, 2012 5:59 am    Post subject: Reply with quote

I would not mind even if the CWP codes were 4 or 5 letters long either (or even user definable names and lengths when the CWP code ends say with underscore. You could write then abbreviating code as you think it is comfortable for you - %it_ %ital_ or %italic_ or %pl_, %spl_ or %simpleplot_ and such codes will be both readable and even better visible) eliminating guessing almost completely and approaching normal human, scientific or IT people language.

Yes, we can make a world record creating extremely functional window full of options just in one single Fortran line but creating it and then reading causes your brain damage.

Code:
i=winio@('%ww%mi[i]%ca[win]%wp[a]%mn[File[Exit]]%th%dd%il%cn%`bg[yellow]%?7rd[index]%ff%nl%cn%^bm[e]%ff','exit',1,1,0,10,j,'exit')




I guess, if Paul thinks to introduce Clearwin+ to other compilers and hopes for its explosive adoption then he should think in advance that users will ask for expansion of Clearwin+ in many other areas including internet, tablets, parallel computing and 2-letter restriction will kill CWP from the inside as some bad design decision which then will be impossible to fix.

Right now when users base is small it is easy to write translator for legacy Clearwin+ which will automatically substitute two letter codes in existing sources of users to any new options it may adopt.

Here is continue of the list above just to think about it as a general idea:

%gd - %grd grid *
%gf - %ghf get handle of font
%gi - %gif add gif image *
%gp - %gpw get position of window *
%gr - %grw graphics window
%he - %hpp help position
%ht - %hpt hypertext
%hw - %hnw handle window
%hx - %hsb horizontal scrolbar **
%ib - %imb image buttom
%ic - %ico icon *
%if - %foc focus *
%il - %ilm integer limit -
%it - %ita italic
%lc - %hlc handle of last control *
%ld - %led LED symbol
%ls - %lbx list box
%lv - %lst list vew
%lw - %kep keep open
%mg - %msg Windows messages
%mi - %mic minimize icon
%mn - %mnu menu
%ms - %msb multi-selection box
%mv - %mov for tracking window movement
%nc - %cnm class name **
%nd - %nod no down
%nr - %nor no right
%ns - %nos no screen saver
%nl - %nwl new line
%ob - %obx open box
%og - %ogl OpenGL **
%pb - %pbx parameter box **
%pd - %pnd UK Pount symbol **
%pl - %spl or %spw SIMPLEPLOT window
%pm - %pop popum menu *
%ps - %pps property sheet *
%pv - %rsz resize ***
%rb - %rbt radiobutton
%rd - %rdi read integer variab ***
%re - %edi editor box **
%rf - see above read FP (%rdf, %rdi, %rdc)
%rj - %rjy right justify -
%rm - %rdm read messages
%rp - %rel relative position
%rs - %rdc see above read character (%rdf, %rdi, %rdc)
%sc - %ini initial call window
%sd - %sub subscript ***
%sf - %sfn standard font
%sh - %psh property sheet
%si - %sti standard icon
%sl - %sld slider
%sm - %smn system menu
%sp - %pos position of window
%ss - %sav save settings
%st - %str string
%su - %sup superscript **
%sv - %ssv screen saver
%sy - %stl style **
%sz - %szw size of window **
%ta - %tab tab *
%tb - %bmb bit map button **
%tc - %col or %clr or %tcl text color
%th - %tth tooltip help
%ti - %tbi task bar icon
%tl - %tln tab length
%ts - %tsz text size
%tt - %tbt text button **
%tv - %tre tree vew
%tx - %txc colored text
%ul - %und underline
%uw - %api to all windows API *
%vx - %vsb vertical screol bar
%wc - %wrc write character variab
%wd - %Wri write integer variab
%we - %wre write real variab
%wf - %wrf write real variab in F format
%wg - %wrg write real variab in G format
%ws - %wrc %wre char variab in A format
%wp - %wlp wallpaper bitmap
%wx - %Whx write hex **
%ww - %win window *[/img]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group