Hi Fang,

welcome back

FangYaqiong wrote:

> 2. For the non complex scripts, there is a glyph table. There are three 
> concepts in this area, they are glyph,
> font and charactor. I am not sure the relaionship betwen them. You said,
>> a glyph table that contains all glyphs for one font that is used in the 
>> flash file.
> I think the non complex scripts, like 26 English charactors, displaying in 
> one font that has 26 kinds of glyphs.
> 
> And each charactor references the corresponding glyph(only one) as index when 
> it needs. My question is :
> When is the table defined?
The method Impl_writeText() calls FlashFont::getGlyph() to get the
index for the glyph. The class FlashFont does the actual caching.
There is an instance of the class FlashFont for each used font.

> Is there a table defined for the complex scripts too?
No, that was the initial problem that this didn't work for complex
script and my fix was to export polygons instead of text glyphs
in that case, which are not cached. Not cached here means that even
if two text runs create the same polygons, they will be exported
twice, not only once.

> 3. "a text runs" is the set of the characters which have the same formating. 
> They can be depicted by the same kind
> of PolyPolygon, the same lines or the same point, I guess. The word "i" 
> contians one glyph but it must be depicted
> by at least two Polygons, one is the line and another is the point on the 
> line. I don't think the word "My" needs
> only one Polygon to present it, but the two charactors has the same kind of 
> Polygons. 
If "My" is a textrun, that would be two Polygons, stored in one
PolyPolygon returned by OutputDevice::GetTextOutline().
(Current solution)

> 4. What's your opinion is that the basic PolyPolygons should be stored in the 
> cache and not the glyphs of the charaters.
> The PolyPolygon and the flash id is defined when the PolyPolygon should be 
> exported and it was not be exported before.
> The PolyPolygon and the flash id is stored together in the cache. But what's 
> the meaning of flash in this area?
Flash or SWF is the format we are writing to, flash uses ids to
reference predefined stuff. You have to make yourself familiar
with the swf file format to work on the flash filter.

> 5. you said,
>> single glyphs would cache better then whole text runs
> But I think that what we discussed above is that we should cache the 
> PolyPolygon not the whole text runs,
> so I cannot get what's you mean.
Yes thats the meaning of "A cache better than B", meaning A is the
better solution.

To make sure we have the same understanding, just an example. Consider
the text runs (lets assume they are complex)

"am" "ma" and "ama"

Currently you get three PolyPolygons. The first two have two polygons
each, one for "a" and one for "m". The third has three polygons, one
for "m" and two for "a".

Now if you only cache the PolyPolygons this will result in exporting
three PolyPolygons. Meaning you exported 7 Polygons. Thats two
wasted for "m" and three wasted for "a".

If you cache on glyph level you would only export two Polygons, one
for "a" and one for "m".

Again, the problem with the current solution is that
OutputDevice::GetTextOutline() returns a PolyPolygon and you are
unable to identify which Polygons belong to one glyph.

For example the text run "ie" gives you a PolyPolygon with
3 Polygons. The first two would be for the "i", but you don't
know that.

Thats why a switch to the method that returns a vector of
B2DPolyPolygon should be used to replace the old GetTextOutline().
Because then you have not one PolyPolygon but one B2DPolyPolygon
for each character.

> 6.
>>Now that will give us a vector with one PolyPolygon for each glyph. 
> For each glyph there is a vector, which contains all the elements of the 
> PolyPolygon, such as the line and the point.
> We know that each glyph may need two or more Polygon to depict it.
> Then how many PolyPolygons will a vector contian, only one or more?
That would be one B2DPolyPolygon per charachter. So the text run "hello"
would return a vector with 5 B2DPolyPolygon. Each of that can contain
more than one B2DPolygon.

>> Now we can add a cache for each PolyPolygon in that vector.
> I can't catch it well. We call a cache for the vector or for each 
> PolyPolygon(all of its elements)?
No, for each B2DPolyPolygon in that vector, check if a B2DPolyPolygon
with the same geometry was already exported. If so, do not export again
but reuse the old flash id.

> 7.
>> Thats because the second "a" is translated so its position is after the 
>> first "a".
> What's the meaning of "translate" here? And how to decompose the translation 
> from the PolyPolygon?

http://en.wikipedia.org/wiki/Translation_%28geometry%29

In a text run "ab", the geometry for "b" would be translated by the
width of "a".

> 8. 
> 
>> The new B2DPolyPolygon is much better than the old one PolyPolygon, but the 
>> old one is still used in the part
>> of the export of the flash. 
>> So another step that we could take is add export of B2DPolyPolygon to
>> the flash export, that would increase the rendering quality.
> Do you think this task is easy for me to begin with? And how to do this?

Do not expect that we will discuss this until you understand everything.
You have to make yourself familiar with the code and with the context
of the problem you like to solve. In this case this includes basic
understanding of working with geometry and also with the swf file
format.

You already know enough to have a look at this task, I would advice
you to do the following.

1. Get the flash filter to compile, make some changes, try to run that
in your OOo
2. Look at the filter code, try to get an idea how it works
3. Debug! Step through the code, set some breakpoints at functions
you find interesting. See when they are called, from where they are
called and what they do.

4. Grep for PolyPolygon in the filter code, see where it is used and how.
Search where they come from. Look at the methods of PolyPolygon
and try to understand what they are doing.

5. Look at the new B2DPolyPolygon class in the basegfx project,
compare it with your understanding of PolyPolygon and analyze
the differences.

Now if you have a question which you can't solve by yourself feel
free to ask. Also you should tell us periodically what you are doing
so we can see if you are still going in the right direction.

But the important part is you have to work with the code, either
by looking at it, debuging it or enhancing it. Preferable all three.

Hope that helps,
Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to