View | Details | Raw Unified | Return to issue 1215
Collapse All | Expand All

(-)vcl/unx/source/gdi/xfont.cxx (-13 / +14 lines)
Lines 59-64 Link Here
59
 *
59
 *
60
 ************************************************************************/
60
 ************************************************************************/
61
61
62
#include <algorithm>
62
#include <salunx.h>
63
#include <salunx.h>
63
64
64
#ifndef EXTENDED_FONTSTRUCT_HXX
65
#ifndef EXTENDED_FONTSTRUCT_HXX
Lines 173-192 Link Here
173
	for ( nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ )
174
	for ( nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ )
174
		if ( mpXFontStruct[ nIdx ] != NULL )
175
		if ( mpXFontStruct[ nIdx ] != NULL )
175
		{
176
		{
176
			*pAscent  = max( mpXFontStruct[nIdx]->ascent,  *pAscent );
177
			*pAscent  = std::max( mpXFontStruct[nIdx]->ascent,  *pAscent );
177
			*pDescent = max( mpXFontStruct[nIdx]->descent, *pDescent );
178
			*pDescent = std::max( mpXFontStruct[nIdx]->descent, *pDescent );
178
179
179
			XCharStruct* pMaxBounds = &(mpXFontStruct[nIdx]->max_bounds);
180
			XCharStruct* pMaxBounds = &(mpXFontStruct[nIdx]->max_bounds);
180
181
181
			pCharStruct->lbearing = max( pMaxBounds->lbearing, 
182
			pCharStruct->lbearing = std::max( pMaxBounds->lbearing, 
182
										 pCharStruct->lbearing );
183
										 pCharStruct->lbearing );
183
			pCharStruct->rbearing = max( pMaxBounds->rbearing, 
184
			pCharStruct->rbearing = std::max( pMaxBounds->rbearing, 
184
										 pCharStruct->rbearing );
185
										 pCharStruct->rbearing );
185
			pCharStruct->width    = max( pMaxBounds->width, 
186
			pCharStruct->width    = std::max( pMaxBounds->width, 
186
										 pCharStruct->width );
187
										 pCharStruct->width );
187
			pCharStruct->ascent   = max( pMaxBounds->ascent, 
188
			pCharStruct->ascent   = std::max( pMaxBounds->ascent, 
188
										 pCharStruct->ascent );
189
										 pCharStruct->ascent );
189
			pCharStruct->descent  = max( pMaxBounds->descent, 
190
			pCharStruct->descent  = std::max( pMaxBounds->descent, 
190
										 pCharStruct->descent );
191
										 pCharStruct->descent );
191
		}
192
		}
192
193
Lines 214-220 Link Here
214
		pFontMetric->mnWidth	 = aBoundingBox.width;
215
		pFontMetric->mnWidth	 = aBoundingBox.width;
215
		pFontMetric->mnAscent	 = aBoundingBox.ascent;
216
		pFontMetric->mnAscent	 = aBoundingBox.ascent;
216
		pFontMetric->mnDescent	 = aBoundingBox.descent;
217
		pFontMetric->mnDescent	 = aBoundingBox.descent;
217
		pFontMetric->mnLeading	 = max(0, aBoundingBox.ascent  - nAscent
218
		pFontMetric->mnLeading	 = std::max(0, aBoundingBox.ascent  - nAscent
218
								  	    + aBoundingBox.descent - nDescent );
219
								  	    + aBoundingBox.descent - nDescent );
219
		// XXX Fix me
220
		// XXX Fix me
220
		pFontMetric->mnFirstChar =   0; 
221
		pFontMetric->mnFirstChar =   0; 
Lines 377-390 Link Here
377
	else
378
	else
378
	{
379
	{
379
		// variable width font
380
		// variable width font
380
		int nMinChar = pXFontStruct->min_char_or_byte2;
381
		sal_Unicode nMinChar = pXFontStruct->min_char_or_byte2;
381
		int nMaxChar = pXFontStruct->max_char_or_byte2;
382
		sal_Unicode nMaxChar = pXFontStruct->max_char_or_byte2;
382
383
383
		int nIdx = nFrom;
384
		int nIdx = nFrom;
384
385
385
		for ( ; nIdx <  min(nTo, nMinChar); nIdx++, pWidthArray++ )
386
		for ( ; nIdx <  std::min(nTo, nMinChar); nIdx++, pWidthArray++ )
386
			*pWidthArray = mnDefaultWidth;
387
			*pWidthArray = mnDefaultWidth;
387
		for ( ; nIdx <= min(nTo, nMaxChar); nIdx++, pWidthArray++ )
388
		for ( ; nIdx <= std::min(nTo, nMaxChar); nIdx++, pWidthArray++ )
388
		{
389
		{
389
			XCharStruct* pChar = &(pXFontStruct->per_char[nIdx - nMinChar]);
390
			XCharStruct* pChar = &(pXFontStruct->per_char[nIdx - nMinChar]);
390
			*pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth;
391
			*pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth;
Lines 554-560 Link Here
554
		{
555
		{
555
			// optimize the most frequent case, requesting only the latin1 
556
			// optimize the most frequent case, requesting only the latin1 
556
			// chars which are mappable to a single encoding
557
			// chars which are mappable to a single encoding
557
			sal_Unicode nMinTo = min(nAsciiRange, nTo);
558
			sal_Unicode nMinTo = std::min((sal_Unicode) nAsciiRange, nTo);
558
			nConverted = GetCharWidth8( nFrom, nMinTo, pWidthArray, nEncoding );
559
			nConverted = GetCharWidth8( nFrom, nMinTo, pWidthArray, nEncoding );
559
		}
560
		}
560
561

Return to issue 1215