General CADD Pro Free Help Forum

Free Support for All Interested in General Cadd Pro

The New Generic CADD for Windows

 
Topic Options
#30877 - 08/04/12 08:13 AM KERNING
Bjorn Holmgren Online   content

Member

Registered: 12/12/01
Posts: 2893
Loc: Sydney Australia
The basics of Kerning. Discussion stuff not a finished program.
Three mcro modes required.
Set up Data file, Edit Data file, Write using Data file.
A random access file containing percentage data for character pairs.
Leading character = horisontal strings (hor column)
Following character = vertical column



A macro reading the file and adjusting distances.

;*** KERNING-TRY.GXM
MO,/VLC;
TZ,!,/VRL,0,$VAL;
/VST,0,ABCDUVWXYZ; test string here
.TESTAFOLLOWEDBYV;
/VST,1,A; find 'A' in test string
/STR,T,$S(0),$S(1),1; the Token string function
/VIN,1,$STR; the token function reveals the seq. number for 'A' in test string ("hor column")
/VST,2,V;
/STR,T,$S(0),$S(2),1; the Token string function
/VIN,2,$STR; the token function reveals the seq. number for 'V' in test string ("vert column")
.READFROMFILEABOVE; (not included here)
;;;/FRD,1,$I(1),/VST,11,$STR; read entry, number = for 'A'
/VST,11,A+100+100+100+100+100+075+100+100+100+100; this is the string that would be read
/SPLIT,$S(11),+,10; the Split string function on '+'.
/VRL,1,$S($I(2)+10); set the value for 'V' entry in string ("vert col")
/VRL,1,$R(0)*$R(1); adjust for text size
/VRL,1,$R(1)/100; divide for percentage value
TL,@,AV,#; unadjusted (non-kerned) text 'AV'
/VPT,1,LP;
TL,$X(1),$Y(1)-1.5*$R(0),$S(1),#; insert 'A' on next row
/VPT,1,LP;
TL,$X(1)+$R(1),$Y(1),$S(2),#; insert 'V' at kerned 0.75*distance read from file
/EXIT;

Top
#30878 - 08/06/12 01:10 PM Re: KERNING - Bjorn [Re: Bjorn Holmgren]
Paul Plutae Offline
Member

Registered: 08/02/07
Posts: 492
Loc: Los Angeles area
Very interesting Bjorn...

What about numbers? 1...10 etc

Top
#30881 - 08/07/12 07:11 AM Re: KERNING [Re: Paul Plutae]
Bjorn Holmgren Online   content

Member

Registered: 12/12/01
Posts: 2893
Loc: Sydney Australia
Paul,
Matt says we have a limit to the length of entries in a random access file. That limit is 255, meaning we can have 254 characters in each entry. The full alphabet, lower and upper case will take up 52*4=208+1 characters. Remains space for 11(*4) with the displayed construction of +100 for each entry.

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.

Thanks,
Bjorn

Top
#30882 - 08/07/12 11:01 AM Re: KERNING [Re: Bjorn Holmgren]
Lew Merrick Offline
Member

Registered: 08/04/06
Posts: 237
Loc: Planet Earth
Ah, but what about punctuation?

Top
#30883 - 08/07/12 11:42 AM Re: KERNING [Re: Bjorn Holmgren]
Matt Offline

Member

Registered: 03/28/02
Posts: 4996
Loc: Spokane, WA
The limit is only for Fixed Record files. The other type of random access file is unlimited in the line length and file length.

Does it need to be fixed record?

Matt

Top
#30884 - 08/07/12 07:41 PM Re: KERNING [Re: Matt]
Bjorn Holmgren Online   content

Member

Registered: 12/12/01
Posts: 2893
Loc: Sydney Australia
Hi Matt,

I am only aware of one type of Random Access Files, the one that opens with /FOP,filename,F,recordlength. Is there a second one?

A basic TXT file is unlimited,but then you can only read that line by line.

Bjorn duh

Top
#30885 - 08/07/12 08:21 PM Re: KERNING [Re: Bjorn Holmgren]
Matt Offline

Member

Registered: 03/28/02
Posts: 4996
Loc: Spokane, WA
Bjorn,

I can see why you would want a fixed length file. I was talking about the txt file, but it looks like you have looked into that and found that it was not a good fit.

What if we make a new fixed length type called U for unlimited or maybe limit it to 1K. /FOP,filename,U,1024;

That way you wouldn't have to change your code much.

What do you think?

Matt


Edited by Matt (08/07/12 08:22 PM)

Top
#30886 - 08/07/12 11:58 PM Re: KERNING [Re: Matt]
Bjorn Holmgren Online   content

Member

Registered: 12/12/01
Posts: 2893
Loc: Sydney Australia
Matt,

In that case could you not just replace the current 'F' file with that new structure, after some testing maybe.

Thought of using HEX to get more space, 100=64 & 075=4B, 2 characters instead of 3. 52*3=156 for the lower/upper case alphabet and space for 32*3 more = 96.

Maybe $HEX() & $DEC() ?

Bjorn

Top
#30887 - 08/08/12 12:42 PM Re: KERNING [Re: Bjorn Holmgren]
Matt Offline

Member

Registered: 03/28/02
Posts: 4996
Loc: Spokane, WA
Sure, I'll add $HEX/$DEC.

It will be a new mode 'U' so the old 'F' mode will remain unchanged.

Matt

Top
#30888 - 08/08/12 01:33 PM Re: KERNING [Re: Bjorn Holmgren]
Matt Offline

Member

Registered: 03/28/02
Posts: 4996
Loc: Spokane, WA
Bjorn,

Why can't you break up the character data onto 2 lines instead of one big line? The first line contains Caps and numbers, 2nd line lower case and punctuation.

Matt

Top
#30893 - 08/09/12 02:33 AM Re: KERNING [Re: Matt]
Bjorn Holmgren Online   content

Member

Registered: 12/12/01
Posts: 2893
Loc: Sydney Australia
Thanks, Matt,

I'll have to provide for any pair of characters in both orders.
The way I have it at the moment :
. leading character sets number 1 thru /STR,T, on $S(0). (HROW)
. trailing character sets number 2 thru /STR,T, on $S(0). (VCOL)
. file read entry number(1)
. position for trailing character(2) found thru /SPLIT on that line read (VCOL)
. that string value should now be the kerning value set in file for those two characters in that order

Not sure how that can work with 2 lines of characters.
I'll think it trough.
I also want to make it possible for a user to read and edit the kerning values in the file.

Bjorn


Edited by Bjorn Holmgren (08/09/12 07:55 AM)

Top
#30902 - 08/14/12 02:30 AM Re: KERNING [Re: Bjorn Holmgren]
Bjorn Holmgren Online   content

Member

Registered: 12/12/01
Posts: 2893
Loc: Sydney Australia
Looking at extents for a kerning file.

These characters are what I can find on my keyboard :
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=~!@#$%^&*()_+,.<>/?;:"[]\{}'|
That's 93 characters.

For practical use, could not some of these be omitted?
The macro can painlessly use hex values for a maximum of 84 characters which would require the entry length of 253.
So can we drop at least 9 ?

(What restricts the size of pics here ???)

The macro can establish a file adapted to a users requirements.

Any thoughts from engravers out there?

Bjorn

Top
#30903 - 08/14/12 08:09 AM Re: KERNING [Re: Bjorn Holmgren]
Bjorn Holmgren Online   content

Member

Registered: 12/12/01
Posts: 2893
Loc: Sydney Australia
/CIN is the code for Character INput.
As it converts all input to upper case it cannot be used for normal text related input in a macro.

Would be nice with a character input command that did not place text directly, just set $STR like /CIN does.

/CHAR,~,/VST,1,$STR;
TP,LP,$S(1),#;

Bjorn

Top
#30907 - 08/14/12 03:26 PM Re: KERNING [Re: Bjorn Holmgren]
Matt Offline

Member

Registered: 03/28/02
Posts: 4996
Loc: Spokane, WA
I can put /CHAR in.

Top
#31106 - 11/23/12 11:55 PM Re: KERNING [Re: Matt]
Bjorn Holmgren Online   content

Member

Registered: 12/12/01
Posts: 2893
Loc: Sydney Australia
An Avadavat is actually a S Asian Waxbill ...



here's the video ...

[video:youtube]http://youtu.be/_Km-Deg1gp0[/video]

suits this demo ...

Ah well, I thought it would appear embedded here ...

Top
#31107 - 11/26/12 03:11 PM Re: KERNING [Re: Bjorn Holmgren]
Matt Offline

Member

Registered: 03/28/02
Posts: 4996
Loc: Spokane, WA
Bjorn,

The latest version in Dropbox GCP-Public has the /CHAR command implemented.

Great stuff Bjorn!

Matt

Top


Moderator:  Bjorn Holmgren 
Search

Who's Online
0 registered (), 2 Guests and Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
Alan Hine, Exchalkie, alkeng, faceimage, calderon
1922 Registered Users
Forum Stats
1922 Members
25 Forums
4035 Topics
27924 Posts

Max Online: 192 @ 10/26/12 11:58 AM
May
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31