F
FangQ
hi
I am doing a very interesting work. The altimate goal is to generate a
new style of bitmap font from an existing one. This involves finding
and replacing 2D patterns.
Here is an example, the original glyph looks like
0000000000000000
1111111111111111
0000000000000000
0011111110000000
0010000010000000
0010000010000000
0010000010000000
0010000010000000
0011111110000000
0010000010000000
0000000000000000
0000000000000000
0000000000000000
which contains a square-like pattern. I want to change it to
0000000000000000
1111111111111111
0000000000000000
0001111100000000
0010000010000000
0010000010000000
0010000010000000
0010000010000000
0010000010000000
0001111100000000
0000000000000000
0000000000000000
0000000000000000
which has a rounded rectangle. Note that the all-0-regions in the two
glyphs can have other patterns, but I want to keep them the same. Note
2: the edge-lengths of the square pattern could be different from one
to another, one glyph may contain multiple of these square patterns.
here is my question:
1. can I do this maching and replacement easily in perl? can you give
me a short example?
2. if not, what is the best tool for this purpose? (I can always write
loops and exhaust all possible combinations with C or other programming
languages, but I think they are not elegant.)
thanks
Qianqian
I am doing a very interesting work. The altimate goal is to generate a
new style of bitmap font from an existing one. This involves finding
and replacing 2D patterns.
Here is an example, the original glyph looks like
0000000000000000
1111111111111111
0000000000000000
0011111110000000
0010000010000000
0010000010000000
0010000010000000
0010000010000000
0011111110000000
0010000010000000
0000000000000000
0000000000000000
0000000000000000
which contains a square-like pattern. I want to change it to
0000000000000000
1111111111111111
0000000000000000
0001111100000000
0010000010000000
0010000010000000
0010000010000000
0010000010000000
0010000010000000
0001111100000000
0000000000000000
0000000000000000
0000000000000000
which has a rounded rectangle. Note that the all-0-regions in the two
glyphs can have other patterns, but I want to keep them the same. Note
2: the edge-lengths of the square pattern could be different from one
to another, one glyph may contain multiple of these square patterns.
here is my question:
1. can I do this maching and replacement easily in perl? can you give
me a short example?
2. if not, what is the best tool for this purpose? (I can always write
loops and exhaust all possible combinations with C or other programming
languages, but I think they are not elegant.)
thanks
Qianqian