Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Prof-UIS Support - Rich Content & style attribute Collapse All
Subject Author Date
Mike Van Duzee May 31, 2011 - 10:06 AM

While looking at the RichContentFeatures sample I realized the style attribute does not appear to be supported.



<html>

<head>

<title></title>

</head>

<body>

<p style="font-family:Courier New;font-size:8mm;color:rgb(0,0,0);text-decoration:underline line-through;">Test Text</p>

</body>

</html>



The above HTML does not render as expected. Is the style attribute supported? If not will it be supported it future versions?

I did not use font tag as it has been deprecated in HTML 4 and removed from HTML5.



Any additional information you can provide regarding HTML Everywhere feature (rich content) would be appreciated.



Thanks

Technical Support Jun 1, 2011 - 1:39 PM

hank you again. But now we have only a temporary fix for font name parser:

void CExtRichContentItem::stat_css_parm_handler_font_family( CExtRichContentItem * pRCI, CExtRichContentItem * pFoundHI,  CExtRichStyleRule & styleChanging, const CExtRichStyleDescription & )
{
/*
POSITION pos = pFoundHI->m_listParms.GetHeadPosition();
    for( ; pos != NULL; )
    {
        CExtRichContentItem * pStylesParmHI = pFoundHI->m_listParms.GetNext( pos );
        CExtSafeString str = LPCTSTR(pStylesParmHI->m_strTagPV);
        str.TrimLeft( __EXT_RICH_CONTENT_TRIM_CHARS_AND_QUOTES );
        str.TrimRight( __EXT_RICH_CONTENT_TRIM_CHARS_AND_QUOTES );
        if( pRCI->ParseFontFamily( styleChanging, LPCTSTR( str ) ) )
            break;
    }
*/
CExtSafeString strReCompose;
POSITION pos = pFoundHI->m_listParms.GetHeadPosition();
bool bFirst = true;
    for( ; pos != NULL; )
    {
        CExtRichContentItem * pStylesParmHI = pFoundHI->m_listParms.GetNext( pos );
        CExtSafeString str = LPCTSTR(pStylesParmHI->m_strTagPV);
        str.TrimLeft( __EXT_RICH_CONTENT_TRIM_CHARS_AND_QUOTES );
        str.TrimRight( __EXT_RICH_CONTENT_TRIM_CHARS_AND_QUOTES );
        if( ! bFirst )
            strReCompose += _T(" ");
        else
            bFirst = false;
        strReCompose += str;
        int nPos = strReCompose.Find( _T(",") );
        if( nPos > 0 )
        {
            CExtSafeString strTry = strReCompose.Left( nPos );
            strTry.TrimLeft( __EXT_RICH_CONTENT_TRIM_CHARS_AND_QUOTES );
            strTry.TrimRight( __EXT_RICH_CONTENT_TRIM_CHARS_AND_QUOTES );
            if( pRCI->ParseFontFamily( styleChanging, LPCTSTR( strTry ) ) )
                return;
            strReCompose = strReCompose.Right( strReCompose.GetLength() - nPos - 1 );
            bFirst = true;
        }
    }
    if( ! strReCompose.IsEmpty() )
    {
        strReCompose.TrimLeft( __EXT_RICH_CONTENT_TRIM_CHARS_AND_QUOTES );
        strReCompose.TrimRight( __EXT_RICH_CONTENT_TRIM_CHARS_AND_QUOTES );
        if( pRCI->ParseFontFamily( styleChanging, LPCTSTR( strReCompose ) ) )
            return;
    }
}

The final parser fix will require more than one method modification and it will be fixed a few hours later today. Please drop us an e-mail to the support mail box at this web site and we will provide you with the fix.

Mike Van Duzee Jun 1, 2011 - 7:09 AM

Again thanks for the quick reply. I may have stumbled upon another CExtRichContentLayout class bug. CExtRichContentItem::ParseCSSValue is parsing "Comic Sans MS" into "comic".



Pasting the below HTML into a document and loading in IE and pasting in the RichContentFeatures sample generate different results.



<html>

<head>

<title></title>

</head>

<body>

<p>

<span style="font-family:Comic Sans MS;font-size:8.46666666666667mm;color:rgb(0,0,0);font-weight:bold;font-style:italic;text-decoration:underline line-through;">Rich Text</span>

</p>

<p></p>

</body>

</html>

Technical Support Jun 1, 2011 - 2:37 AM

You found a bug in the CExtRichContentLayout class. The mm units are converted to target device units incorrectly. Thank you. Please update the source code for the following method:

LONG CExtRichContentLayout::ConvMm2Px( DOUBLE lgMm, bool bHorz ) const
{
DOUBLE lfRes = lgMm * ( bHorz ? DOUBLE(g_PaintManager.m_nLPX) : DOUBLE(g_PaintManager.m_nLPY) ) / 2.54 / 10.0;
DOUBLE lfResCeil = ::ceil( lfRes );
DOUBLE lfFraction = 1.0 - ( lfResCeil - lfRes );
    if( lfFraction >= 0.5 )
        lfRes = lfResCeil;
    else
        lfRes = ::floor( lfRes );
    return LONG(lfRes);
}

Both updated methods are inside 2.92. You can drop us an e-mail to the support mail box and we will provide you with 2.92 download.

Mike Van Duzee May 31, 2011 - 1:33 PM

Thanks for the quick reply. The code provided allows multiple text-decoration’s to be applied. Will this be included in Prof-UIS 2.9.2?



On another CSS style attribute note, font-size:8mm appears to be converted to 3px which doesn’t match other HTML renders (I.E., Firefox, Etc.).



Pasting the below HTML into a document and loading in IE and pasting in the RichContentFeatures sample generate different results.



<html>

<head>

<title></title>

</head>

<body>

<p>

<span style="font-family:Gabriola Bold Italic;font-size:8mm;color:rgb(0,0,0);font-weight:bold;font-style:italic;text-decoration:underline line-through;">Rich Text Format</span>

<span style="font-family:Gabriola Bold Italic;font-size:3px;color:rgb(0,0,0);font-weight:bold;font-style:italic;text-decoration:underline line-through;">Rich Text Format</span>

<span style="font-family:Gabriola Bold Italic;font-size:30px;color:rgb(0,0,0);font-weight:bold;font-style:italic;text-decoration:underline line-through;">Rich Text Format</span>

</p>

<p></p>

</body>

</html>

Technical Support May 31, 2011 - 11:19 AM

Thank you for reporting this issue. We implemented a single value text-decoration CSS attribute. I.e. you can only specify text-decoration:underline; or text-decoration:line-through;. But it’s not difficult to extend text-decoration support for multiple values. Please update the source code for the following method:

void CExtRichContentItem::stat_css_parm_handler_text_decoration( CExtRichContentItem *, CExtRichContentItem * pFoundHI,  CExtRichStyleRule & styleChanging, const CExtRichStyleDescription & )
{
int nCount = int(pFoundHI->m_listParms.GetCount());
    if( nCount < 1 )
        return;
POSITION pos = pFoundHI->m_listParms.GetHeadPosition();
    for( ; pos != NULL; )
    {
        CExtRichContentItem * pStylesParmHI = pFoundHI->m_listParms.GetNext( pos );
        CExtSafeString str = LPCTSTR(pStylesParmHI->m_strTagPV);
        str.TrimLeft( __EXT_RICH_CONTENT_TRIM_CHARS );
        str.TrimRight( __EXT_RICH_CONTENT_TRIM_CHARS );
        if( str.IsEmpty() )
            continue;
        str.MakeLower();
        if( str == _T("underline") )
            styleChanging.m_nUnderline = 1;
        if( str == _T("line-through") )
            styleChanging.m_nStrikeOut = 1;
//        if( str == _T("overline") )
//            styleChanging.m_nOverline = 1;
//        if( str == _T("blink") )
//            styleChanging.m_nBlink = 1;
    }
}