[ncl-talk] Where are the functions processing the string information in a CGM file?

Mary Haley haley at ucar.edu
Fri Sep 25 09:21:25 MDT 2015


Gin Lin,

The actual strings of the stroked characters will NOT be in the file,
because they are drawn with line strokes instead of actual characters.
This gives you a better looking font than the non-stroked fonts.

As an example, I wrote an NCL script that creates two text strings: one
written with a stroked font, and one written with a non-stroked font.  See
the attached text.ncgm file.  I also included the text.ncl NCL script just
in case.

Note that the string "Stroked font" is of much better quality than the
string "Non-stroked font". That's because the stroked font was drawn with
filled polygons, rather than simple character strings.

Further, if you run:

ctrans -d CTXT text.ncgm > text.ctxt

and look at the text.ctxt file, you will see the polygon draw calls, which
look like this:

INTERIOR STYLE
interior style  ->  solid

POLYGON
        206 points follow:
                P(0)    ->  11649,  26570
       P(1)    ->  11649,  26601
P(2)    ->  11646,  26632
. . .

If you go further down in the text.ctxt file, you will see:

TEXT
        position        ->   5851,  19660
final/not final ->  final
        string          -> "N"

TEXT
position        ->   7255,  19660
final/not final ->  final
        string          -> "o"

TEXT
        position        ->   8659,  19660
final/not final ->  final
        string          -> "n"

TEXT
        position        ->  10064,  19660
        final/not final ->  final
        string          -> "-"

TEXT
        position        ->  11468,  19660
        final/not final ->  final
        string          -> "s"

If you look at the "string" word, you will see that this is the start of
the "Non-stroked font" string.

So, I'm sorry to say that there's no way to determine which strings are
associated with the polygon draws, especially if you have other plot
elements, like axes, tickmarks, etc.  These are all drawn with polygons
and/or polylines.

--Mary


On Fri, Sep 25, 2015 at 2:22 AM, <Gin.Lin at iisigroup.com> wrote:

> Hi, Mary.
>
> Thanks for your reply.
>
> Do you mean these strings are still in the file, they are just stroked
> because they use high quality fonts?
>
> If so, do I have no way to know how they are defined in the file?
>
> I mean, if I don't know where they are,
>
> I can't find where the Idt and our AWIPS program handle them, not to
> mention solving our problem.
>
>
>
> I constructed the text file with command: "ctrans -d CTXT (binary file
> name) > (output text)"
>
> Is there any option that can make the high quality font information be
> viewable?
>
> Or the only way is going to ask the person who generated these binary
> files?
>
>
>
> Thank you.
>
> Gin Lin.
>
> -----Mary Haley <haley at ucar.edu> 撰寫:-----
> 收件人: Gin.Lin at iisigroup.com
> 寄件人: Mary Haley <haley at ucar.edu>
> 日期: 09/25/2015 12:02上午
> 副本抄送: bobo.wang at iisigroup.com, charlie.chang at iisigroup.com, "
> ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>
> 主旨: Re: [ncl-talk] Where are the functions processing the string
> information in a CGM file?
>
> Hi Gin Lin,
>
> It's possible that these text strings were drawn with stroked fonts, and
> hence they won't show up as actual text strings in your CGM.
>
> I don't know how these strings were created, but if they were drawn using
> the "medium" or "high" quality fonts, then they will be stroked.  If they
> were drawn using "low" quality, then the characters will be output as
> strings in the metafile.
>
> From the images you sent me, they do not look like low quality fonts, so
> my guess is that they are stroked fonts, and hence you won't be able to
> search for the actual string in the metafile.
>
> --Mary
>
>
> On Thu, Sep 24, 2015 at 3:15 AM, <Gin.Lin at iisigroup.com> wrote:
>
>> Hi, Mary.
>>
>> Thanks for your reply.
>>
>> I think you are right, the files are actually NCGM,
>>
>> I found out there is a switch-case which looks like checking the input
>> file is CGM or NCGM in our program.
>>
>> Both of this two files are judged as NCGM.
>>
>>
>>
>> I tried to use ctrans today, and I got the text files translated from the
>> binary files.
>>
>> The attachment is the header of the original file which can be viewed
>> correctly in AWIPS and the new file which cannot.
>>
>> I know they look like the same. I think the problem may not be the
>> difference of their header.
>>
>>
>>
>> I tried to search the strings such as "JMA", "CROSS", "PRESSURE" in the
>> text file,
>>
>> but they can't be found.
>>
>> So I'm still confused at how Idt and our AWIPS program show it on the
>> picture.
>>
>> Can you give me some advice?
>>
>>
>>
>> Thank you.
>>
>> Gin Lin.
>>
>>
>> -----ncl-talk-bounces at ucar.edu 撰寫:-----
>> 收件人: Gin.Lin at iisigroup.com
>> 寄件人: Mary Haley
>> 傳送自: ncl-talk-bounces at ucar.edu
>> 日期: 09/24/2015 10:40上午
>> 副本抄送: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>,
>> charlie.chang at iisigroup.com, bobo.wang at iisigroup.com
>> 主旨: Re: [ncl-talk] Where are the functions processing the string
>> information in a CGM file?
>>
>>
>> Gin Lin,
>>
>> Idt is a very old program, and the original developer is not part of our
>> team any more.
>>
>> However, I'm wondering if part of your issue is that idt is for viewing
>> NCGM files, and not CGM files. An NCGM file is NCAR's special CGM format. I
>> would be surprised if other programs were actually able to view NCGM files.
>>
>> Did you try using "ncgm2cgm" to convert the NCGM to a CGM file?  You can
>> also look at the ncgm2cgm.c and cgm2ncgm.c programs to see the code that
>> converts from one format to another.  This might help you find the source
>> of the problem.
>>
>> I've attached the two codes here.
>>
>> Finally, you may want to read our "CGM, Graphicap, and Fontcap
>> Supplement" document, which contains a section on the "NCAR Computer
>> Graphics Metafile".
>>
>> http://www.ncarg.ucar.edu/supplements/cgm_supp/cgm_supp.html
>>
>> --Mary
>>
>>
>> On Tue, Sep 22, 2015 at 9:57 PM, <Gin.Lin at iisigroup.com> wrote:
>>
>>> Dear all:
>>>
>>> First let me introduce our situation.
>>>
>>> I am one member in CWB in Taiwan, 20 years ago someone write a program
>>> for AWIPS,
>>>
>>> so we can view the CGM file by using AWIPS.
>>>
>>> Recently, the format of the CGM files we get is changed, and this
>>> program cannot show the string information in the new CGM files.
>>>
>>> You can see the attachments, the color one is what it looks like in idt,
>>>
>>> and the green one is what it looks like in AWIPS,
>>>
>>> and the messages marked by read lines in the idt picture disappeared in
>>> the AWIPS picture.
>>>
>>> We want to edit this program to fix it.
>>>
>>>
>>>
>>> I checked our program for AWIPS, but I can't find where is the function
>>> which print out the string information.
>>>
>>> I think it may not belong to the TEXT element of class 4.
>>>
>>> The files we have are all binary, so I can't read them.
>>>
>>> I also tried to read the source code of idt but I can't understand it.
>>> Forgive me.
>>>
>>>
>>>
>>> So, my questions are:
>>>
>>> 1. Where are the functions processing this string information in a CGM
>>> file?
>>>
>>> or more briefly, how idt print out this information on the picture?
>>>
>>> 2. Where are the strings in a CGM file?
>>>
>>> Do they belong to the class 4 TEXT element?
>>>
>>> Or they are actually another element?
>>>
>>>
>>>
>>> Thank you.
>>>
>>> Gin Lin
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> [附加檔案 "cgm2ncgm.c" 由 Gin Lin/iisigroup 移除]
>> [附加檔案 "ncgm2cgm.c" 由 Gin Lin/iisigroup 移除]
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150925/456ddf48/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text.ctxt
Type: application/octet-stream
Size: 47223 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150925/456ddf48/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text.ncgm
Type: application/octet-stream
Size: 12960 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150925/456ddf48/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text.ncl
Type: application/octet-stream
Size: 418 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150925/456ddf48/attachment-0002.obj 


More information about the ncl-talk mailing list