/* draw.c -- drawing module.
- Copyright (C) 2003, 2004, 2005, 2006, 2007
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H15PRO112
MGlyph *g;
int i;
#ifdef HAVE_FRIBIDI
- FriBidiCharType base = bidi_sensitive ? FRIBIDI_TYPE_RTL : FRIBIDI_TYPE_LTR;
+ FriBidiParType base = bidi_sensitive ? FRIBIDI_TYPE_RTL : FRIBIDI_TYPE_LTR;
FriBidiChar *logical = alloca (sizeof (FriBidiChar) * len);
FriBidiLevel *levels;
FriBidiStrIndex *indices;
for (i = 1; i < gstring->used - 1; i++)
{
MGlyph *g = gstring->glyphs + i;
+ int level = g->bidi_level;
for (j = i; g->g.from == gstring->glyphs[j + 1].g.from; j++);
- if (j > i)
+ if ((level % 2) && j > i)
{
memcpy (glyphs + i, gstring->glyphs + i,
sizeof (MGlyph) * (j - i + 1));
}
}
-#if 0
-static void
-reorder_combining_chars (MGlyphString *gstring, int from, int to)
+static MSymbol
+font_id (MFLTFont *font)
{
- MGlyph *g, *gbeg = MGLYPH (from + 1), *gend = MGLYPH (to), temp;
- int reordered = 1;
-
- while (reordered)
- {
- reordered = 0;
- for (g = gbeg; g != gend; g++)
- if (COMBINING_CODE_CLASS (g->combining_code) > 0
- && (COMBINING_CODE_CLASS (g[-1].combining_code)
- > COMBINING_CODE_CLASS (g->combining_code)))
- {
- reordered = 1;
- temp = *g;
- *g = g[-1];
- g[-1] = temp;
- }
- }
+ return ((MFLTFontForRealized *) font)->rfont->id;
}
-#endif
static int
run_flt (MGlyphString *gstring, int from, int to, MRealizedFace *rface)
MFLT *flt;
int from_pos = MGLYPH (from)->g.from;
int len = to - from;
+ int catcode;
int i;
flt = mflt_get (layouter);
font.font.drive_otf = rfont->driver->drive_otf;
font.font.internal = NULL;
font.rfont = rfont;
+ mflt_font_id = font_id;
+ mflt_iterate_otf_feature = rfont->driver->iterate_otf_feature;
+ mflt_try_otf = rfont->driver->try_otf;
for (i = 0; i < 3; i++)
{
to = mflt_run (&flt_gstr, from, to, &font.font, flt);
}
if (from + len != to)
gstring->used += to - (from + len);
- for (i = from; i < to; i++)
+ for (i = from, catcode = -1; i < to; i++)
{
MGlyph *g = MGLYPH (i);
g->g.xoff >>= 6;
g->g.yoff >>= 6;
g->rface = rface;
+ if (catcode < 0 || g->g.from != g[-1].g.from)
+ {
+ MSymbol category = mchar_get_prop (g->g.c, Mcategory);
+
+ catcode = (category == McatCf
+ ? GLYPH_CATEGORY_FORMATTER
+ : category != Mnil && MSYMBOL_NAME (category)[0] == 'M'
+ ? GLYPH_CATEGORY_MODIFIER
+ : GLYPH_CATEGORY_NORMAL);
+ }
+ g->category = catcode;
}
return to;
}
{
MSymbol category = mchar_get_prop (g[-1].g.c, Mcategory);
- if (MSYMBOL_NAME (category)[0] != 'Z')
+ if (category != Mnil && MSYMBOL_NAME (category)[0] != 'Z')
this_script = script;
}
}
break;
}
}
+ if (this_script == Minherited || this_script == Mcommon)
+ this_script = (MSymbol) mchar_get_prop (c, Mblock);
}
pos = g->g.from;
for (g++;
(g->type == GLYPH_CHAR
- && g->g.from != gstring->control.cursor_pos
&& g->rface->layouter == this->rface->layouter
&& (g->rface->rfont == this->rface->rfont
|| (g->category == GLYPH_CATEGORY_FORMATTER
|| memcmp (control, &gstring->control,
(char *) (&control->with_cursor)
- (char *) (control))
+ || control->cursor_pos != gstring->control.cursor_pos
|| control->cursor_width != gstring->control.cursor_width
|| control->cursor_bidi != gstring->control.cursor_bidi)
{
MbidiS = msymbol ("S");
MbidiNSM = msymbol ("NSM");
#ifdef HAVE_FRIBIDI
+#if FRIBIDI_INTERFACE_VERSION < 3
fribidi_set_mirroring (TRUE);
+#else
+ fribidi_set_mirroring (1);
+#endif
#endif
M_break_at_space = msymbol ("bs");
M_kinsoku_bol = msymbol ("kb");
M_kinsoku_eol = msymbol ("ke");
+ mflt_enable_new_feature = 1;
+
return 0;
}
@return
½èÍý¤¬À®¸ù¤·¤¿¾ì¹ç¡¢mdraw_image_text () ¤Ï 0
- ¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï -1 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #m_errro ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£
+ ¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï -1 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£
@latexonly \IPAlabel{mdraw_image_text} @endlatexonly */
this function also follows what specified in the drawing control
object $CONTROL.
- For instance, if <two_dimensional> of $CONTROL is nonzero, this
+ For instance, if \<two_dimensional\> of $CONTROL is nonzero, this
function draw an M-text 2-dimensionally, i.e., newlines in M-text
breaks lines and the following characters are drawn in the next
line. See the documentation of the structure @ MDrawControl for
¥Æ¥¥¹¥È¤ÎÉÁ²èÊýË¡¤Ï mdraw_text () ¤È¤Û¤ÜƱ¤¸¤Ç¤¢¤ë¤¬¡¢¤³¤Î´Ø¿ô¤ÏÉÁ²èÀ©¸æÍѤΥª¥Ö¥¸¥§¥¯¥È
$CONTROL ¤Î»Ø¼¨¤Ë¤â½¾¤¦ÅÀ¤¬°Û¤Ê¤Ã¤Æ¤¤¤ë¡£
- ¤¿¤È¤¨¤Ð $CONTROL ¤Î <two_dimensional> ¤¬¥¼¥í¤Ç¤Ê¤±¤ì¤Ð¡¢¤³¤Î´Ø¿ô¤Ï
+ ¤¿¤È¤¨¤Ð $CONTROL ¤Î \<two_dimensional\> ¤¬¥¼¥í¤Ç¤Ê¤±¤ì¤Ð¡¢¤³¤Î´Ø¿ô¤Ï
M-text ¤ò2¼¡¸µÅª¤ËÉÁ¤¯¡£¤¹¤Ê¤ï¤Á M-text Ãæ¤Î²þ¹Ô¤Ç¹Ô¤ò²þ¤á¡¢Â³¤¯Ê¸»ú¤Ï¼¡¤Î¹Ô¤ËÉÁ¤¯¡£¾ÜºÙ¤Ï¹½Â¤ÂÎ
@ MDrawControl ¤ÎÀâÌÀ¤ò»²¾È¤¹¤ë¤³¤È¡£*/
character, and incremented each time when a long line is broken
because of the width limit.
- @return This function returns a character position to break the
+ @return
+ This function returns a character position to break the
line.
*/