本文整理汇总了C++中NSToCoordRound函数的典型用法代码示例。如果您正苦于以下问题:C++ NSToCoordRound函数的具体用法?C++ NSToCoordRound怎么用?C++ NSToCoordRound使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NSToCoordRound函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetCharSpacing
static void
GetCharSpacing(nsMathMLChar* aMathMLChar,
nsOperatorFlags aForm,
PRInt32 aScriptLevel,
nscoord em,
nscoord& aLeftSpace,
nscoord& aRightSpace)
{
nsAutoString data;
aMathMLChar->GetData(data);
nsOperatorFlags flags = 0;
float lspace = 0.0f;
float rspace = 0.0f;
PRBool found = nsMathMLOperators::LookupOperator(data, aForm,
&flags, &lspace, &rspace);
// We don't want extra space when we are a script
if (found && aScriptLevel > 0) {
lspace /= 2.0f;
rspace /= 2.0f;
}
aLeftSpace = NSToCoordRound(lspace * em);
aRightSpace = NSToCoordRound(rspace * em);
}
开发者ID:mozilla,项目名称:mozilla-history,代码行数:25,代码来源:nsMathMLmfencedFrame.cpp
示例2: NS_ASSERTION
/* static */ nscoord
nsMathMLFrame::CalcLength(nsPresContext* aPresContext,
nsStyleContext* aStyleContext,
const nsCSSValue& aCSSValue)
{
NS_ASSERTION(aCSSValue.IsLengthUnit(), "not a length unit");
if (aCSSValue.IsFixedLengthUnit()) {
return aCSSValue.GetLengthTwips();
}
nsCSSUnit unit = aCSSValue.GetUnit();
if (eCSSUnit_Pixel == unit) {
return NSFloatPixelsToTwips(aCSSValue.GetFloatValue(),
aPresContext->ScaledPixelsToTwips());
}
else if (eCSSUnit_EM == unit) {
const nsStyleFont* font = aStyleContext->GetStyleFont();
return NSToCoordRound(aCSSValue.GetFloatValue() * (float)font->mFont.size);
}
else if (eCSSUnit_XHeight == unit) {
nscoord xHeight;
const nsStyleFont* font = aStyleContext->GetStyleFont();
nsCOMPtr<nsIFontMetrics> fm = aPresContext->GetMetricsFor(font->mFont);
fm->GetXHeight(xHeight);
return NSToCoordRound(aCSSValue.GetFloatValue() * (float)xHeight);
}
return 0;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:31,代码来源:nsMathMLFrame.cpp
示例3: NS_ASSERTION
/* static */ nscoord
nsMathMLFrame::CalcLength(nsPresContext* aPresContext,
nsStyleContext* aStyleContext,
const nsCSSValue& aCSSValue)
{
NS_ASSERTION(aCSSValue.IsLengthUnit(), "not a length unit");
if (aCSSValue.IsFixedLengthUnit()) {
return aCSSValue.GetFixedLength(aPresContext);
}
if (aCSSValue.IsPixelLengthUnit()) {
return aCSSValue.GetPixelLength();
}
nsCSSUnit unit = aCSSValue.GetUnit();
if (eCSSUnit_EM == unit) {
const nsStyleFont* font = aStyleContext->GetStyleFont();
return NSToCoordRound(aCSSValue.GetFloatValue() * (float)font->mFont.size);
}
else if (eCSSUnit_XHeight == unit) {
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext,
getter_AddRefs(fm));
nscoord xHeight = fm->XHeight();
return NSToCoordRound(aCSSValue.GetFloatValue() * (float)xHeight);
}
// MathML doesn't specify other CSS units such as rem or ch
NS_ERROR("Unsupported unit");
return 0;
}
开发者ID:jraff,项目名称:mozilla-central,代码行数:32,代码来源:nsMathMLFrame.cpp
示例4: NSToCoordRound
/* Performs the matrix multiplication necessary to multiply the two matrices,
* then hands back a reference to ourself.
*/
nsStyleTransformMatrix&
nsStyleTransformMatrix::operator *= (const nsStyleTransformMatrix &aOther)
{
/* We'll buffer all of our results into a temporary storage location
* during this operation since we don't want to overwrite the values of
* the old matrix with the values of the new.
*/
float newMatrix[4];
nscoord newDelta[2];
float newX[2];
float newY[2];
/* [this] [aOther]
* |a1 c1 e1| |a0 c0 e0| |a0a1 + b0c1 c0a1 + d0c1 e0a1 + f0c1 + e1|
* |b1 d1 f1|x|b0 d0 f0| = |a0b1 + b0d1 c0b1 + d0d1 e0b1 + f0d1 + f1|
* |0 0 1 | | 0 0 1| | 0 0 1|
*/
newMatrix[0] = aOther.mMain[0] * mMain[0] + aOther.mMain[1] * mMain[2];
newMatrix[1] = aOther.mMain[0] * mMain[1] + aOther.mMain[1] * mMain[3];
newMatrix[2] = aOther.mMain[2] * mMain[0] + aOther.mMain[3] * mMain[2];
newMatrix[3] = aOther.mMain[2] * mMain[1] + aOther.mMain[3] * mMain[3];
newDelta[0] = NSToCoordRound(aOther.mDelta[0] * mMain[0] +
aOther.mDelta[1] * mMain[2]) + mDelta[0];
newDelta[1] = NSToCoordRound(aOther.mDelta[0] * mMain[1] +
aOther.mDelta[1] * mMain[3]) + mDelta[1];
/* For consistent terminology, let u0, u1, v0, and v1 be the four transform
* coordinates from our matrix, and let x0, x1, y0, and y1 be the four
* transform coordinates from the other matrix. Then the new transform
* coordinates are:
*
* u0' = a1u0 + c1u1 + x0
* u1' = b1u0 + d1u1 + x1
* v0' = a1v0 + c1v1 + y0
* v1' = b1v0 + d1v1 + y1
*/
newX[0] = mMain[0] * aOther.mX[0] + mMain[2] * aOther.mX[1] + mX[0];
newX[1] = mMain[1] * aOther.mX[0] + mMain[3] * aOther.mX[1] + mX[1];
newY[0] = mMain[0] * aOther.mY[0] + mMain[2] * aOther.mY[1] + mY[0];
newY[1] = mMain[1] * aOther.mY[0] + mMain[3] * aOther.mY[1] + mY[1];
/* Now, write everything back in. */
for (PRInt32 index = 0; index < 4; ++index)
mMain[index] = newMatrix[index];
for (PRInt32 index = 0; index < 2; ++index) {
mDelta[index] = newDelta[index];
mX[index] = newX[index];
mY[index] = newY[index];
}
/* As promised, return a reference to ourselves. */
return *this;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:56,代码来源:nsStyleTransformMatrix.cpp
示例5: switch
void
nsMathMLmpaddedFrame::UpdateValue(int32_t aSign,
int32_t aPseudoUnit,
const nsCSSValue& aCSSValue,
const ReflowOutput& aDesiredSize,
nscoord& aValueToUpdate,
float aFontSizeInflation) const
{
nsCSSUnit unit = aCSSValue.GetUnit();
if (NS_MATHML_SIGN_INVALID != aSign && eCSSUnit_Null != unit) {
nscoord scaler = 0, amount = 0;
if (eCSSUnit_Percent == unit || eCSSUnit_Number == unit) {
switch(aPseudoUnit) {
case NS_MATHML_PSEUDO_UNIT_WIDTH:
scaler = aDesiredSize.Width();
break;
case NS_MATHML_PSEUDO_UNIT_HEIGHT:
scaler = aDesiredSize.BlockStartAscent();
break;
case NS_MATHML_PSEUDO_UNIT_DEPTH:
scaler = aDesiredSize.Height() - aDesiredSize.BlockStartAscent();
break;
default:
// if we ever reach here, it would mean something is wrong
// somewhere with the setup and/or the caller
NS_ERROR("Unexpected Pseudo Unit");
return;
}
}
if (eCSSUnit_Number == unit)
amount = NSToCoordRound(float(scaler) * aCSSValue.GetFloatValue());
else if (eCSSUnit_Percent == unit)
amount = NSToCoordRound(float(scaler) * aCSSValue.GetPercentValue());
else
amount = CalcLength(PresContext(), mStyleContext, aCSSValue,
aFontSizeInflation);
if (NS_MATHML_SIGN_PLUS == aSign)
aValueToUpdate += amount;
else if (NS_MATHML_SIGN_MINUS == aSign)
aValueToUpdate -= amount;
else
aValueToUpdate = amount;
}
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:50,代码来源:nsMathMLmpaddedFrame.cpp
示例6: switch
void
nsMathMLmpaddedFrame::UpdateValue(PRInt32 aSign,
PRInt32 aPseudoUnit,
const nsCSSValue& aCSSValue,
const nsBoundingMetrics& aBoundingMetrics,
nscoord& aValueToUpdate) const
{
nsCSSUnit unit = aCSSValue.GetUnit();
if (NS_MATHML_SIGN_INVALID != aSign && eCSSUnit_Null != unit) {
nscoord scaler = 0, amount = 0;
if (eCSSUnit_Percent == unit || eCSSUnit_Number == unit) {
switch(aPseudoUnit) {
case NS_MATHML_PSEUDO_UNIT_WIDTH:
scaler = aBoundingMetrics.width;
break;
case NS_MATHML_PSEUDO_UNIT_HEIGHT:
scaler = aBoundingMetrics.ascent;
break;
case NS_MATHML_PSEUDO_UNIT_DEPTH:
scaler = aBoundingMetrics.descent;
break;
default:
// if we ever reach here, it would mean something is wrong
// somewhere with the setup and/or the caller
NS_ERROR("Unexpected Pseudo Unit");
return;
}
}
if (eCSSUnit_Number == unit)
amount = NSToCoordRound(float(scaler) * aCSSValue.GetFloatValue());
else if (eCSSUnit_Percent == unit)
amount = NSToCoordRound(float(scaler) * aCSSValue.GetPercentValue());
else
amount = CalcLength(PresContext(), mStyleContext, aCSSValue);
nscoord oldValue = aValueToUpdate;
if (NS_MATHML_SIGN_PLUS == aSign)
aValueToUpdate += amount;
else if (NS_MATHML_SIGN_MINUS == aSign)
aValueToUpdate -= amount;
else
aValueToUpdate = amount;
}
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:49,代码来源:nsMathMLmpaddedFrame.cpp
示例7:
/* static */ void
nsMathMLFrame::ParseNumericValue(const nsString& aString,
nscoord* aLengthValue,
uint32_t aFlags,
nsPresContext* aPresContext,
nsStyleContext* aStyleContext)
{
nsCSSValue cssValue;
if (!nsMathMLElement::ParseNumericValue(aString, cssValue, aFlags,
aPresContext->Document())) {
// Invalid attribute value. aLengthValue remains unchanged, so the default
// length value is used.
return;
}
nsCSSUnit unit = cssValue.GetUnit();
if (unit == eCSSUnit_Percent || unit == eCSSUnit_Number) {
// Relative units. A multiple of the default length value is used.
*aLengthValue = NSToCoordRound(*aLengthValue * (unit == eCSSUnit_Percent ?
cssValue.GetPercentValue() :
cssValue.GetFloatValue()));
return;
}
// Absolute units.
*aLengthValue = CalcLength(aPresContext, aStyleContext, cssValue);
}
开发者ID:jraff,项目名称:mozilla-central,代码行数:29,代码来源:nsMathMLFrame.cpp
示例8: fm
NS_IMETHODIMP
nsRenderingContextQt::GetTextDimensions(const char* aString, PRUint32 aLength,
nsTextDimensions& aDimensions)
{
aDimensions.Clear();
if (aLength == 0)
return NS_OK;
if (nsnull == aString)
return NS_ERROR_FAILURE;
QString str = QString::fromLatin1(aString, aLength);
QFontMetrics fm(mCurrentFont->font);
aDimensions.ascent = NSToCoordRound(fm.ascent()*mP2T);
aDimensions.descent = NSToCoordRound(fm.descent()*mP2T);
aDimensions.width = NSToCoordRound(fm.width(str)*mP2T);
return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:17,代码来源:nsRenderingContextQt.cpp
示例9: AppUnitsFromMM
static nscoord
AppUnitsFromMM(nsIFrame* aFrame, uint32_t aMM, bool aVertical)
{
nsPresContext* pc = aFrame->PresContext();
float result = float(aMM) *
(pc->DeviceContext()->AppUnitsPerPhysicalInch() / MM_PER_INCH_FLOAT);
return NSToCoordRound(result);
}
开发者ID:cynthiatang,项目名称:gecko-dev,代码行数:8,代码来源:PositionedEventTargeting.cpp
示例10: StyleDisplay
void
nsMeterFrame::ReflowBarFrame(nsIFrame* aBarFrame,
nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
bool vertical = StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL;
nsHTMLReflowState reflowState(aPresContext, aReflowState, aBarFrame,
nsSize(aReflowState.ComputedWidth(),
NS_UNCONSTRAINEDSIZE));
nscoord size = vertical ? aReflowState.ComputedHeight()
: aReflowState.ComputedWidth();
nscoord xoffset = aReflowState.mComputedBorderPadding.left;
nscoord yoffset = aReflowState.mComputedBorderPadding.top;
// NOTE: Introduce a new function getPosition in the content part ?
double position, max, min, value;
nsCOMPtr<nsIDOMHTMLMeterElement> meterElement =
do_QueryInterface(mContent);
meterElement->GetMax(&max);
meterElement->GetMin(&min);
meterElement->GetValue(&value);
position = max - min;
position = position != 0 ? (value - min) / position : 1;
size = NSToCoordRound(size * position);
if (!vertical && StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
xoffset += aReflowState.ComputedWidth() - size;
}
// The bar position is *always* constrained.
if (vertical) {
// We want the bar to begin at the bottom.
yoffset += aReflowState.ComputedHeight() - size;
size -= reflowState.mComputedMargin.TopBottom() +
reflowState.mComputedBorderPadding.TopBottom();
size = std::max(size, 0);
reflowState.SetComputedHeight(size);
} else {
size -= reflowState.mComputedMargin.LeftRight() +
reflowState.mComputedBorderPadding.LeftRight();
size = std::max(size, 0);
reflowState.SetComputedWidth(size);
}
xoffset += reflowState.mComputedMargin.left;
yoffset += reflowState.mComputedMargin.top;
nsHTMLReflowMetrics barDesiredSize;
ReflowChild(aBarFrame, aPresContext, barDesiredSize, reflowState, xoffset,
yoffset, 0, aStatus);
FinishReflowChild(aBarFrame, aPresContext, &reflowState, barDesiredSize,
xoffset, yoffset, 0);
}
开发者ID:BrunoReX,项目名称:palemoon,代码行数:58,代码来源:nsMeterFrame.cpp
示例11: return
NS_IMETHODIMP
nsRenderingContextQt::GetBoundingMetrics(const char *aString,PRUint32 aLength,
nsBoundingMetrics &aBoundingMetrics)
{
aBoundingMetrics.Clear();
if (0 >= aLength || !aString || !mCurrentFont)
return(NS_ERROR_FAILURE);
QString str = QString::fromLatin1(aString, aLength);
QFontMetrics fm(mCurrentFont->font);
QRect br = fm.boundingRect(str);
aBoundingMetrics.width = NSToCoordRound(br.width() * mP2T);
aBoundingMetrics.ascent = NSToCoordRound(-br.y() * mP2T);
aBoundingMetrics.descent = NSToCoordRound(br.bottom() * mP2T);
aBoundingMetrics.leftBearing = NSToCoordRound(br.x() * mP2T);
aBoundingMetrics.rightBearing = NSToCoordRound(fm.rightBearing(str.at(aLength - 1)) * mP2T);
return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:18,代码来源:nsRenderingContextQt.cpp
示例12: AppUnitsFromMM
static nscoord
AppUnitsFromMM(nsIFrame* aFrame, uint32_t aMM, bool aVertical)
{
nsPresContext* pc = aFrame->PresContext();
nsIPresShell* presShell = pc->PresShell();
float result = float(aMM) *
(pc->DeviceContext()->AppUnitsPerPhysicalInch() / MM_PER_INCH_FLOAT) *
(aVertical ? presShell->GetYResolution() : presShell->GetXResolution());
return NSToCoordRound(result);
}
开发者ID:bakulf,项目名称:mozilla-central,代码行数:10,代码来源:PositionedEventTargeting.cpp
示例13: AllocateUnassigned
static inline nscoord
AllocateUnassigned(nscoord aUnassignedSpace, float aShare)
{
if (aShare == 1.0f) {
// This happens when the numbers we're dividing to get aShare
// are equal. We want to return unassignedSpace exactly, even
// if it can't be precisely round-tripped through float.
return aUnassignedSpace;
}
return NSToCoordRound(float(aUnassignedSpace) * aShare);
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:11,代码来源:FixedTableLayoutStrategy.cpp
示例14: GetWidth
NS_IMETHODIMP nsRenderingContextPh :: GetWidth(const char* aString, PRUint32 aLength, nscoord& aWidth )
{
PhRect_t extent;
/* Check for the very common case of trying to get the width of a single space */
if( aString[0] == ' ' && aLength == 1 )
return mFontMetrics->GetSpaceWidth(aWidth);
PfExtent( &extent, NULL, mPhotonFontName, 0L, 0L, aString, aLength, PF_SIMPLE_METRICS, NULL );
aWidth = NSToCoordRound((int) ((extent.lr.x - extent.ul.x + 1) * mP2T));
return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:12,代码来源:nsRenderingContextPh.cpp
示例15: AppUnitsFromMM
static nscoord
AppUnitsFromMM(nsIFrame* aFrame, uint32_t aMM)
{
nsPresContext* pc = aFrame->PresContext();
nsIPresShell* presShell = pc->PresShell();
float result = float(aMM) *
(pc->DeviceContext()->AppUnitsPerPhysicalInch() / MM_PER_INCH_FLOAT);
if (presShell->ScaleToResolution()) {
result = result / presShell->GetResolution();
}
return NSToCoordRound(result);
}
开发者ID:rnd-user,项目名称:gecko-dev,代码行数:12,代码来源:PositionedEventTargeting.cpp
示例16: NSToCoordFloor
nscoord
nsMathMLmfracFrame::CalcLineThickness(nsPresContext* aPresContext,
nsStyleContext* aStyleContext,
nsString& aThicknessAttribute,
nscoord onePixel,
nscoord aDefaultRuleThickness)
{
nscoord defaultThickness = aDefaultRuleThickness;
nscoord lineThickness = aDefaultRuleThickness;
nscoord minimumThickness = onePixel;
if (!aThicknessAttribute.IsEmpty()) {
if (aThicknessAttribute.EqualsLiteral("thin")) {
lineThickness = NSToCoordFloor(defaultThickness * THIN_FRACTION_LINE);
minimumThickness = onePixel * THIN_FRACTION_LINE_MINIMUM_PIXELS;
// should visually decrease by at least one pixel, if default is not a pixel
if (defaultThickness > onePixel && lineThickness > defaultThickness - onePixel)
lineThickness = defaultThickness - onePixel;
}
else if (aThicknessAttribute.EqualsLiteral("medium")) {
lineThickness = NSToCoordRound(defaultThickness * MEDIUM_FRACTION_LINE);
minimumThickness = onePixel * MEDIUM_FRACTION_LINE_MINIMUM_PIXELS;
// should visually increase by at least one pixel
if (lineThickness < defaultThickness + onePixel)
lineThickness = defaultThickness + onePixel;
}
else if (aThicknessAttribute.EqualsLiteral("thick")) {
lineThickness = NSToCoordCeil(defaultThickness * THICK_FRACTION_LINE);
minimumThickness = onePixel * THICK_FRACTION_LINE_MINIMUM_PIXELS;
// should visually increase by at least two pixels
if (lineThickness < defaultThickness + 2*onePixel)
lineThickness = defaultThickness + 2*onePixel;
}
else { // see if it is a plain number, or a percentage, or a h/v-unit like 1ex, 2px, 1em
nsCSSValue cssValue;
if (ParseNumericValue(aThicknessAttribute, cssValue)) {
nsCSSUnit unit = cssValue.GetUnit();
if (eCSSUnit_Number == unit)
lineThickness = nscoord(float(defaultThickness) * cssValue.GetFloatValue());
else if (eCSSUnit_Percent == unit)
lineThickness = nscoord(float(defaultThickness) * cssValue.GetPercentValue());
else if (eCSSUnit_Null != unit)
lineThickness = CalcLength(aPresContext, aStyleContext, cssValue);
}
}
}
// use minimum if the lineThickness is a non-zero value less than minimun
if (lineThickness && lineThickness < minimumThickness)
lineThickness = minimumThickness;
return lineThickness;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:53,代码来源:nsMathMLmfracFrame.cpp
示例17: curFontMetrics
NS_IMETHODIMP nsRenderingContextQt::GetWidth(const char *aString, PRUint32 aLength,nscoord &aWidth)
{
if (0 == aLength) {
aWidth = 0;
return NS_OK;
}
if (nsnull == aString || nsnull == mCurrentFont)
return NS_ERROR_FAILURE;
QFontMetrics curFontMetrics(mCurrentFont->font);
int rawWidth = curFontMetrics.width(QString::fromLatin1(aString, aLength));
aWidth = NSToCoordRound(rawWidth * mP2T);
return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:14,代码来源:nsRenderingContextQt.cpp
示例18: str
NS_IMETHODIMP
nsRenderingContextQt::GetTextDimensions(const PRUnichar *aString,
PRUint32 aLength,
nsTextDimensions &aDimensions,
PRInt32 *aFontID)
{
aDimensions.Clear();
if (0 == aLength)
return NS_OK;
if (nsnull == aString)
return NS_ERROR_FAILURE;
QConstString str((const QChar *)aString, aLength);
QFontMetrics fm(mCurrentFont->font);
aDimensions.ascent = NSToCoordRound(fm.ascent()*mP2T);
aDimensions.descent = NSToCoordRound(fm.descent()*mP2T);
aDimensions.width = NSToCoordRound(fm.width(str.string())*mP2T);
if (nsnull != aFontID)
*aFontID = 0;
return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:23,代码来源:nsRenderingContextQt.cpp
示例19: GetTextRunBoundingMetrics
static void
GetTextRunBoundingMetrics(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aLength,
nsThebesRenderingContext *aContext,
nsBoundingMetrics &aBoundingMetrics)
{
StubPropertyProvider provider;
gfxTextRun::Metrics theMetrics =
aTextRun->MeasureText(aStart, aLength, PR_TRUE, aContext->ThebesContext(), &provider);
aBoundingMetrics.leftBearing = NSToCoordFloor(theMetrics.mBoundingBox.X());
aBoundingMetrics.rightBearing = NSToCoordCeil(theMetrics.mBoundingBox.XMost());
aBoundingMetrics.width = NSToCoordRound(theMetrics.mAdvanceWidth);
aBoundingMetrics.ascent = NSToCoordCeil(- theMetrics.mBoundingBox.Y());
aBoundingMetrics.descent = NSToCoordCeil(theMetrics.mBoundingBox.YMost());
}
开发者ID:PolyMtl,项目名称:crash-inducing,代码行数:15,代码来源:00148b3ae7d11b330a1f77f1e7520fcb2a396881.cpp
示例20: SpaceWidth
nscoord
nsFontMetrics::GetWidth(const char16_t* aString, uint32_t aLength,
DrawTarget* aDrawTarget)
{
if (aLength == 0)
return 0;
if (aLength == 1 && aString[0] == ' ')
return SpaceWidth();
StubPropertyProvider provider;
AutoTextRun textRun(this, aDrawTarget, aString, aLength);
if (textRun.get()) {
return NSToCoordRound(
textRun->GetAdvanceWidth(Range(0, aLength), &provider));
}
return 0;
}
开发者ID:ekr,项目名称:gecko-dev,代码行数:18,代码来源:nsFontMetrics.cpp
注:本文中的NSToCoordRound函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论