Re: ib - r31623 - abiword/trunk/src/af/gr/xp

Ingo Brückl <[email protected]>
Newsgroups gmane.editors.abiword.devel
Message-ID <[email protected]>
Simon Larochelle wrote on Sun, 5 Aug 2012 15:57:39 -0400:

> I made a patch to solve the first issue (stop using Symbol and
> Dingbats fonts). It is attached to bug #12334.

The good news: It seems to work now.

After your patches I've applied symbols.l.remove.patch for a clean
environment and have removed my fontconfig Dingbats font mapping.

There are some remaining issue though.

(1) The first one is a new display issue. The display area for the bullets
glyphs seems too small, i.e. bullets like hands, arrows and arrowheads are
cut at the right side, missing the finger, tip and head. This is with font
selection of current font and wasn't the case before the your patches. It's
a (annoying) display issue, the print seems ok.

(2) We are still forcing (changing) field font "Symbol" for two bullets in
RTF import/export (and MsWord_97 import, and "Dingbats" in RTF export). I'm
not sure, but is RTF import used for AbiWord's internal copy and paste, too?
(I can't test, because pasting still crashes on my system - a bug still to be
examined.)

(3) The issues with the "Insert Symbol" dialog and TTF Symbol remain. We
could remove the whole Symbol/Dingbats stuff (no longer needed after your
patch, see remove.symbol.dingbats.patch) from gr_CairoGraphics.cpp which
fixes these issues then.

(4) BTW, there are still usages of Symbol in fl_BlockLayout.cpp and
xap_Draw_Symbol.cpp.

So, were do we stand now? I'd vote for your patches and would myself commit
the two attached patches afterwards. Issue still to be solved / things still
to look at are: (1), (2), and (4). All in all, things are greatly improved
now.

Ingo
symbols.l.remove.patch (text/x-diff, 2.7 KB)
diff -Nurb a/plugins/wmf/plugin.m4 b/plugins/wmf/plugin.m4
--- a/plugins/wmf/plugin.m4	2012-04-30 16:15:10.000000000 +0200
+++ b/plugins/wmf/plugin.m4	2012-08-07 10:52:51.000000000 +0200
@@ -7,15 +7,6 @@
 	AC_PATH_PROG(libwmfconfig, libwmf-config)
 ])
 
-AC_ARG_WITH([standard_symbols_l], 
-	[AS_HELP_STRING([--with-standard-symbols-l], [use font family 'Standard Symbols L' for Symbol])],   
-[
-	abi_cv_standard_symbols_l="$withval"
-])
-if test "$abi_cv_standard_symbols_l" = "yes"; then
-	AC_DEFINE([WITH_STANDARD_SYMBOLS_L], [1], [Use font family 'Standard Symbols L' for Symbol])
-fi
-
 # The required libwmf version, as reported by libwmf-config
 libwmf_major_req=0
 libwmf_minor_req=2
diff -Nurb a/src/af/gr/xp/gr_CairoGraphics.cpp b/src/af/gr/xp/gr_CairoGraphics.cpp
--- a/src/af/gr/xp/gr_CairoGraphics.cpp	2012-08-07 10:39:58.000000000 +0200
+++ b/src/af/gr/xp/gr_CairoGraphics.cpp	2012-08-07 10:45:00.000000000 +0200
@@ -2548,11 +2548,7 @@
 	if (szLCFontName)
 	{
 		xxx_UT_DEBUGMSG(("GR_CairoGraphics::setFont: %s\n", szLCFontName));
-#ifdef WITH_STANDARD_SYMBOLS_L
-		if(strstr(szLCFontName,"standard symbols l") != NULL)
-#else
 		if(strstr(szLCFontName,"symbol") != NULL)
-#endif		
 		{
 			/*
 			 * I am not too happy about this, and do not want to see the exception
diff -Nurb a/src/text/ptbl/xp/pt_PT_Styles.cpp b/src/text/ptbl/xp/pt_PT_Styles.cpp
--- a/src/text/ptbl/xp/pt_PT_Styles.cpp	2012-08-07 10:40:03.000000000 +0200
+++ b/src/text/ptbl/xp/pt_PT_Styles.cpp	2012-08-07 10:48:01.000000000 +0200
@@ -19,9 +19,6 @@
  * 02111-1307, USA.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include "ut_locale.h"
 #include "ut_types.h"
 #include "ut_misc.h"
diff -Nurb a/src/wp/ap/xp/ap_Dialog_Lists.cpp b/src/wp/ap/xp/ap_Dialog_Lists.cpp
--- a/src/wp/ap/xp/ap_Dialog_Lists.cpp	2012-08-07 10:40:03.000000000 +0200
+++ b/src/wp/ap/xp/ap_Dialog_Lists.cpp	2012-08-07 10:48:53.000000000 +0200
@@ -21,10 +21,6 @@
 #include <stdio.h>
 #include <string.h>
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "ap_Features.h"
 
 #include "ut_assert.h"
diff -Nurb a/src/wp/impexp/xp/ie_imp_RTF.cpp b/src/wp/impexp/xp/ie_imp_RTF.cpp
--- a/src/wp/impexp/xp/ie_imp_RTF.cpp	2012-07-31 09:54:40.000000000 +0200
+++ b/src/wp/impexp/xp/ie_imp_RTF.cpp	2012-08-07 10:46:34.000000000 +0200
@@ -358,19 +358,11 @@
 	    FieldFont = m_pParaProps->m_pszFieldFont;
     if(abiListType == BULLETED_LIST)
     {
-#ifdef WITH_STANDARD_SYMBOLS_L
-        FieldFont = "Standard Symbols L";
-#else
         FieldFont = "Symbol";
-#endif
     }
     if(abiListType == IMPLIES_LIST)
     {
-#ifdef WITH_STANDARD_SYMBOLS_L
-        FieldFont = "Standard Symbols L";
-#else
         FieldFont = "Symbol";
-#endif
     }
     *szFieldFont = FieldFont.c_str();
 //
remove.symbol.dingbats.patch (text/x-diff, 10.7 KB)
diff -urb ./src/af/gr/xp/gr_CairoGraphics.cpp /usr/src/projects/abiword/src/af/gr/xp/gr_CairoGraphics.cpp
--- ./src/af/gr/xp/gr_CairoGraphics.cpp	2012-08-07 10:45:00.000000000 +0200
+++ /usr/src/projects/abiword/src/af/gr/xp/gr_CairoGraphics.cpp	2012-08-07 12:14:37.000000000 +0200
@@ -61,9 +61,6 @@
 }
 #endif
 
-UT_uint32 adobeDingbatsToUnicode(UT_uint32 iAdobe);
-UT_uint32 adobeToUnicode(UT_uint32 iAdobe);
-
 UT_uint32      GR_CairoGraphics::s_iInstanceCount = 0;
 UT_VersionInfo GR_CairoGraphics::s_Version;
 int            GR_CairoGraphics::s_iMaxScript = 0;
@@ -366,8 +363,6 @@
 	m_capStyle(CAP_BUTT),
 	m_lineStyle(LINE_SOLID),
 	m_linePropsDirty(false),
-	m_bIsSymbol(false),
-	m_bIsDingbat(false),
 	m_iPrevX1(0),
 	m_iPrevX2(0),
 	m_iPrevY1(0),
@@ -402,8 +397,6 @@
 	m_capStyle(CAP_BUTT),
 	m_lineStyle(LINE_SOLID),
 	m_linePropsDirty(false),
-	m_bIsSymbol(false),
-	m_bIsDingbat(false),
 	m_iPrevX1(0),
 	m_iPrevX2(0),
 	m_iPrevY1(0),
@@ -771,7 +764,6 @@
 
 	GR_PangoRenderInfo * RI = (GR_PangoRenderInfo *)ri;
 
-	// need this so that isSymbol() and isDingbat() are correct
 	setFont(si.m_pFont);
 
 	/*
@@ -809,11 +801,6 @@
 	{
 		UT_return_val_if_fail(si.m_Text.getStatus() == UTIter_OK, false);
 		UT_UCS4Char c = si.m_Text.getChar();
-		if(isSymbol())
-			utf8 += adobeToUnicode(c);
-		else if(isDingbat())
-			utf8 += adobeDingbatsToUnicode(c);
-		else {
 			
 			if (si.m_TextTransform == GR_ShapingInfo::LOWERCASE)
 				c = g_unichar_tolower(c);
@@ -827,7 +814,6 @@
 			
 			utf8 += c;
 			previousWasSpace = g_unichar_isspace(c);
-		}
 
 		if (pfs)
 		{
@@ -2067,14 +2053,6 @@
 	for(i = 0; i < RI.m_iLength; ++i, ++(*(RI.m_pText)))
 	{
 		UT_return_val_if_fail(RI.m_pText->getStatus() == UTIter_OK, 0);
-		if(isSymbol())
-		{
-			utf8 += adobeToUnicode(RI.m_pText->getChar());
-		}
-		else if(isDingbat())
-		{
-			utf8 += adobeDingbatsToUnicode(RI.m_pText->getChar());
-		}
 		utf8 += RI.m_pText->getChar();
 	}
 	
@@ -2135,14 +2113,6 @@
 	for(i = 0; i < RI.m_iLength; ++i, ++(*(RI.m_pText)))
 	{
 		UT_return_if_fail(RI.m_pText->getStatus() == UTIter_OK);
-		if(isSymbol())
-		{
-			utf8 += adobeToUnicode(RI.m_pText->getChar());
-		}
-		else if(isDingbat())
-		{
-			utf8 += adobeDingbatsToUnicode(RI.m_pText->getChar());
-		}
 		utf8 += RI.m_pText->getChar();
 	}
 
@@ -2208,25 +2178,7 @@
 		return;
 	_setProps();
 	UT_UTF8String utf8;
-	xxx_UT_DEBUGMSG(("isDingBat %d \n",isDingbat()));
-	if(isSymbol())
-	{
-		for(int i = iCharOffset; i < iCharOffset + iLength; ++i)
-		{
-			utf8 += adobeToUnicode(pChars[i]);
-		}
-	}
-	else if(isDingbat())
-	{
-		for(int i = iCharOffset; i < iCharOffset + iLength; ++i)
-		{
-			utf8 += adobeDingbatsToUnicode(pChars[i]);
-		}
-	}
-	else
-	{
 		utf8.appendUCS4(pChars + iCharOffset, iLength);
-	}
 
 	// this function expect indexes in bytes !!! (stupid)
 	GList * pItems = pango_itemize(getContext(),
@@ -2345,24 +2297,7 @@
 	if (!iLength || iLength <= iCharOffset)
 		return 0;
 	
-	if(isSymbol())
-	{
-		for(int i = iCharOffset; i < iCharOffset + iLength; ++i)
-		{
-			utf8 += adobeToUnicode(pChars[i]);
-		}
-	}
-	else if(isDingbat())
-	{
-		for(int i = iCharOffset; i < iCharOffset + iLength; ++i)
-		{
-			utf8 += adobeDingbatsToUnicode(pChars[i]);
-		}
-	}
-	else
-	{
 		utf8.appendUCS4(pChars + iCharOffset, iLength);
-	}
 
 	// this function expect indexes in bytes !!! (stupid)
 	GList * pItems = pango_itemize(getLayoutContext(),
@@ -2538,33 +2473,6 @@
 	//PangoFont * pf = (PangoFont*) pFont;
 	m_pPFont = const_cast<GR_PangoFont*>(static_cast<const GR_PangoFont*>(pFont));
 
-	_setIsSymbol(false);
-	_setIsDingbat(false);
-
-	const char* familyName = m_pPFont->getFamily();
-
-	char * szLCFontName = familyName ? g_utf8_strdown (familyName, -1) : NULL;
-
-	if (szLCFontName)
-	{
-		xxx_UT_DEBUGMSG(("GR_CairoGraphics::setFont: %s\n", szLCFontName));
-		if(strstr(szLCFontName,"symbol") != NULL)
-		{
-			/*
-			 * I am not too happy about this, and do not want to see the exception
-			 * list to grow much more, but cannot think of another simple solution.
-			 */
-			if(!strstr(szLCFontName,"starsymbol") &&
-			   !strstr(szLCFontName,"opensymbol") &&
-			   !strstr(szLCFontName,"symbolnerve"))
-				_setIsSymbol(true);
-		}
-		
-		if(strstr(szLCFontName,"dingbat"))
-			_setIsDingbat(true);
-		FREEP(szLCFontName);
-	}
-		
 	if(!m_pPFont->isGuiFont() && m_pPFont->getZoom() != getZoomPercentage())
 	{
 		m_pPFont->reloadFont(this);
@@ -3798,100 +3706,6 @@
 }
 
 
-UT_uint32 adobeToUnicode(UT_uint32 c)
-{
-	/*
-	 * generated from
-	 * http://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/symbol.txt
-	 * maps Adobe Symbol Encoding to Unicode
-	 */
-	static const UT_uint32 map[256] = {
-		/* 0x00 */      0,     0,     0,     0,     0,     0,     0,     0,
-				0,     0,     0,     0,     0,     0,     0,     0,
-		/* 0x10 */      0,     0,     0,     0,     0,     0,     0,     0,
-				0,     0,     0,     0,     0,     0,     0,     0,
-		/* 0x20 */ 0x0020,0x0021,0x2200,0x0023,0x2203,0x0025,0x0026,0x220B,
-			   0x0028,0x0029,0x2217,0x002B,0x002C,0x2212,0x002E,0x002F,
-		/* 0x30 */ 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
-			   0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
-		/* 0x40 */ 0x2245,0x0391,0x0392,0x03A7,0x0394,0x0395,0x03A6,0x0393,
-			   0x0397,0x0399,0x03D1,0x039A,0x039B,0x039C,0x039D,0x039F,
-		/* 0x50 */ 0x03A0,0x0398,0x03A1,0x03A3,0x03A4,0x03A5,0x03C2,0x03A9,
-			   0x039E,0x03A8,0x0396,0x005B,0x2234,0x005D,0x22A5,0x005F,
-		/* 0x60 */ 0xF8E5,0x03B1,0x03B2,0x03C7,0x03B4,0x03B5,0x03C6,0x03B3,
-			   0x03B7,0x03B9,0x03D5,0x03BA,0x03BB,0x00B5,0x03BD,0x03BF,
-		/* 0x70 */ 0x03C0,0x03B8,0x03C1,0x03C3,0x03C4,0x03C5,0x03D6,0x03C9,
-			   0x03BE,0x03C8,0x03B6,0x007B,0x007C,0x007D,0x223C,     0,
-		/* 0x80 */      0,     0,     0,     0,     0,     0,     0,     0,
-				0,     0,     0,     0,     0,     0,     0,     0,
-		/* 0x90 */      0,     0,     0,     0,     0,     0,     0,     0,
-				0,     0,     0,     0,     0,     0,     0,     0,
-		/* 0xA0 */ 0x20AC,0x03D2,0x2032,0x2264,0x2044,0x221E,0x0192,0x2663,
-			   0x2666,0x2665,0x2660,0x2194,0x2190,0x2191,0x2192,0x2193,
-		/* 0xB0 */ 0x00B0,0x00B1,0x2033,0x2265,0x00D7,0x221D,0x2202,0x2022,
-			   0x00F7,0x2260,0x2261,0x2248,0x2026,0xF8E6,0xF8E7,0x21B5,
-		/* 0xC0 */ 0x2135,0x2111,0x211C,0x2118,0x2297,0x2295,0x2205,0x2229,
-			   0x222A,0x2283,0x2287,0x2284,0x2282,0x2286,0x2208,0x2209,
-		/* 0xD0 */ 0x2220,0x2207,0xF6DA,0xF6D9,0xF6DB,0x220F,0x221A,0x22C5,
-			   0x00AC,0x2227,0x2228,0x21D4,0x21D0,0x21D1,0x21D2,0x21D3,
-		/* 0xE0 */ 0x25CA,0x2329,0xF8E8,0xF8E9,0xF8EA,0x2211,0xF8EB,0xF8EC,
-			   0xF8ED,0xF8EE,0xF8EF,0xF8F0,0xF8F1,0xF8F2,0xF8F3,0xF8F4,
-		/* 0xF0 */      0,0x232A,0x222B,0x2320,0xF8F5,0x2321,0xF8F6,0xF8F7,
-			   0xF8F8,0xF8F9,0xF8FA,0xF8FB,0xF8FC,0xF8FD,0xF8FE,     0,
-		};
-	if (c <= 0xFF && map[c] != 0)
-		return map[c];
-	else
-		return c;
-}
-
-UT_uint32 adobeDingbatsToUnicode(UT_uint32 c)
-{
-	/*
-	 * generated from
-	 * http://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/zdingbat.txt
-	 * maps Adobe Zapf Dingbats Encoding to Unicode
-	 */
-	static const UT_uint32 map[256] = {
-		/* 0x00 */      0,     0,     0,     0,     0,     0,     0,     0,
-		                0,     0,     0,     0,     0,     0,     0,     0,
-		/* 0x10 */      0,     0,     0,     0,     0,     0,     0,     0,
-		                0,     0,     0,     0,     0,     0,     0,     0,
-		/* 0x20 */ 0x0020,0x2701,0x2702,0x2703,0x2704,0x260E,0x2706,0x2707,
-		           0x2708,0x2709,0x261B,0x261E,0x270C,0x270D,0x270E,0x270F,
-		/* 0x30 */ 0x2710,0x2711,0x2712,0x2713,0x2714,0x2715,0x2716,0x2717,
-		           0x2718,0x2719,0x271A,0x271B,0x271C,0x271D,0x271E,0x271F,
-		/* 0x40 */ 0x2720,0x2721,0x2722,0x2723,0x2724,0x2725,0x2726,0x2727,
-		           0x2605,0x2729,0x272A,0x272B,0x272C,0x272D,0x272E,0x272F,
-		/* 0x50 */ 0x2730,0x2731,0x2732,0x2733,0x2734,0x2735,0x2736,0x2737,
-		           0x2738,0x2739,0x273A,0x273B,0x273C,0x273D,0x273E,0x273F,
-		/* 0x60 */ 0x2740,0x2741,0x2742,0x2743,0x2744,0x2745,0x2746,0x2747,
-		           0x2748,0x2749,0x274A,0x274B,0x25CF,0x274D,0x25A0,0x274F,
-		/* 0x70 */ 0x2750,0x2751,0x2752,0x25B2,0x25BC,0x25C6,0x2756,0x25D7,
-		           0x2758,0x2759,0x275A,0x275B,0x275C,0x275D,0x275E,     0,
-		/* 0x80 */ 0xF8D7,0xF8D8,0xF8D9,0xF8DA,0xF8DB,0xF8DC,0xF8DD,0xF8DE,
-		           0xF8DF,0xF8E0,0xF8E1,0xF8E2,0xF8E3,0xF8E4,     0,     0,
-		/* 0x90 */      0,     0,     0,     0,     0,     0,     0,     0,
-		                0,     0,     0,     0,     0,     0,     0,     0,
-		/* 0xA0 */      0,0x2761,0x2762,0x2763,0x2764,0x2765,0x2766,0x2767,
-		           0x2663,0x2666,0x2665,0x2660,0x2460,0x2461,0x2462,0x2463,
-		/* 0xB0 */ 0x2464,0x2465,0x2466,0x2467,0x2468,0x2469,0x2776,0x2777,
-		           0x2778,0x2779,0x277A,0x277B,0x277C,0x277D,0x277E,0x277F,
-		/* 0xC0 */ 0x2780,0x2781,0x2782,0x2783,0x2784,0x2785,0x2786,0x2787,
-		           0x2788,0x2789,0x278A,0x278B,0x278C,0x278D,0x278E,0x278F,
-		/* 0xD0 */ 0x2790,0x2791,0x2792,0x2793,0x2794,0x2192,0x2194,0x2195,
-		           0x2798,0x2799,0x279A,0x279B,0x279C,0x279D,0x279E,0x279F,
-		/* 0xE0 */ 0x27A0,0x27A1,0x27A2,0x27A3,0x27A4,0x27A5,0x27A6,0x27A7,
-		           0x27A8,0x27A9,0x27AA,0x27AB,0x27AC,0x27AD,0x27AE,0x27AF,
-		/* 0xF0 */      0,0x27B1,0x27B2,0x27B3,0x27B4,0x27B5,0x27B6,0x27B7,
-		           0x27B8,0x27B9,0x27BA,0x27BB,0x27BC,0x27BD,0x27BE,     0,
-		};
-	if (c <= 0xFF && map[c] != 0)
-		return map[c];
-	else
-		return c;
-}
-
 void GR_Font::s_getGenericFontProperties(const char * /*szFontName*/,
 										 FontFamilyEnum * pff,
 										 FontPitchEnum * pfp,
diff -urb ./src/af/gr/xp/gr_CairoGraphics.h /usr/src/projects/abiword/src/af/gr/xp/gr_CairoGraphics.h
--- ./src/af/gr/xp/gr_CairoGraphics.h	2012-05-26 09:38:18.000000000 +0200
+++ /usr/src/projects/abiword/src/af/gr/xp/gr_CairoGraphics.h	2012-08-07 12:08:50.000000000 +0200
@@ -260,9 +260,6 @@
 	virtual void		invertRect(const UT_Rect* pRect);
 	virtual void		drawLine(UT_sint32, UT_sint32, UT_sint32, UT_sint32);
 
-	bool isDingbat(void) const {return m_bIsDingbat;}
-	bool isSymbol(void) const {return m_bIsSymbol;};
-
 	void resetFontMapResolution(void);
 
 	virtual GR_Font* _findFont(const char* pszFontFamily,
@@ -363,9 +360,6 @@
 										   UT_BidiCharType iVisDir,
 										   const char * pUtf8);
 
-	void         _setIsSymbol(bool b) {m_bIsSymbol = b;}
-	void         _setIsDingbat(bool b) {m_bIsDingbat = b;}
-
 	PangoFont *  _adjustedPangoFont (GR_PangoFont * pFont, PangoFont * pf);
 	PangoFont *  _adjustedLayoutPangoFont (GR_PangoFont * pFont, PangoFont * pf);
 
@@ -406,8 +400,6 @@
 	GR_Graphics::CapStyle  m_capStyle;
 	GR_Graphics::LineStyle m_lineStyle;
 	bool            m_linePropsDirty;
-	bool                    m_bIsSymbol;
-	bool                    m_bIsDingbat;
 	UT_sint32               m_iPrevX1;
 	UT_sint32               m_iPrevX2;
 	UT_sint32               m_iPrevY1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.