Added new font intropsection methods to nsIFontMetrics

This commit is contained in:
kipp%netscape.com 1998-09-10 23:41:25 +00:00
Родитель 5b9d478efe
Коммит 00188db105
7 изменённых файлов: 94 добавлений и 0 удалений

Просмотреть файл

@ -236,6 +236,30 @@ NS_IMETHODIMP nsFontMetricsMac :: Init(const nsFont& aFont, nsIDeviceContext* aC
mLeading = 0;
}*/
NS_IMETHODIMP
nsFontMetricsMac :: GetXHeight(nscoord& aResult)
{
// aResult = mMaxAscent / 2; // XXX temporary code!
aResult = 0;/* XXX */
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsMac :: GetSuperscriptOffset(nscoord& aResult)
{
// aResult = mMaxAscent / 2; // XXX temporary code!
aResult = 0;/* XXX */
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsMac :: GetSubscriptOffset(nscoord& aResult)
{
// aResult = mMaxAscent / 2; // XXX temporary code!
aResult = 0;/* XXX */
return NS_OK;
}
NS_IMETHODIMP nsFontMetricsMac :: GetWidth(char ch, nscoord &aWidth)
{
//if (ch < 256)

Просмотреть файл

@ -41,6 +41,9 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHOD Init(const nsFont& aFont, nsIDeviceContext* aContext);
NS_IMETHOD GetXHeight(nscoord& aResult);
NS_IMETHOD GetSuperscriptOffset(nscoord& aResult);
NS_IMETHOD GetSubscriptOffset(nscoord& aResult);
NS_IMETHOD GetWidth(char aC, nscoord &aWidth);
NS_IMETHOD GetWidth(PRUnichar aC, nscoord &aWidth);
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth);

Просмотреть файл

@ -272,6 +272,27 @@ void nsFontMetricsUnix::RealizeFont()
mLeading = 0;
}
NS_IMETHODIMP
nsFontMetricsUnix :: GetXHeight(nscoord& aResult)
{
aResult = mMaxAscent / 2; // XXX temporary code!
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsUnix :: GetSuperscriptOffset(nscoord& aResult)
{
aResult = mMaxAscent / 2; // XXX temporary code!
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsUnix :: GetSubscriptOffset(nscoord& aResult)
{
aResult = mMaxAscent / 2; // XXX temporary code!
return NS_OK;
}
NS_IMETHODIMP nsFontMetricsUnix :: GetWidth(char ch, nscoord &aWidth)
{
char buf[1];

Просмотреть файл

@ -45,6 +45,9 @@ public:
NS_IMETHOD Init(const nsFont& aFont, nsIDeviceContext* aContext);
NS_IMETHOD Destroy();
NS_IMETHOD GetXHeight(nscoord& aResult);
NS_IMETHOD GetSuperscriptOffset(nscoord& aResult);
NS_IMETHOD GetSubscriptOffset(nscoord& aResult);
NS_IMETHOD GetWidth(char aC, nscoord &aWidth);
NS_IMETHOD GetWidth(PRUnichar aC, nscoord &aWidth);
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth);

Просмотреть файл

@ -61,6 +61,25 @@ public:
*/
NS_IMETHOD Destroy() = 0;
/**
* Return the font's xheight property, scaled into app-units.
*/
NS_IMETHOD GetXHeight(nscoord& aResult) = 0;
/**
* Return the font's superscript offset (the distance from the
* baseline to where a superscript's baseline should be placed). The
* value returned will be a positive value.
*/
NS_IMETHOD GetSuperscriptOffset(nscoord& aResult) = 0;
/**
* Return the font's subscript offset (the distance from the
* baseline to where a subscript's baseline should be placed). The
* value returned will be a positive value.
*/
NS_IMETHOD GetSubscriptOffset(nscoord& aResult) = 0;
/**
* Returns the width (in app units) of an 8-bit character
*/

Просмотреть файл

@ -233,6 +233,27 @@ nsFontMetricsWin::RealizeFont()
::ReleaseDC(win, dc);
}
NS_IMETHODIMP
nsFontMetricsWin :: GetXHeight(nscoord& aResult)
{
aResult = mMaxAscent / 2; // XXX temporary code!
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsWin :: GetSuperscriptOffset(nscoord& aResult)
{
aResult = mMaxAscent / 2; // XXX temporary code!
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsWin :: GetSubscriptOffset(nscoord& aResult)
{
aResult = mMaxAscent / 2; // XXX temporary code!
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsWin :: GetWidth(char ch, nscoord& aWidth)
{

Просмотреть файл

@ -45,6 +45,9 @@ public:
NS_IMETHOD Init(const nsFont& aFont, nsIDeviceContext* aContext);
NS_IMETHOD Destroy();
NS_IMETHOD GetXHeight(nscoord& aResult);
NS_IMETHOD GetSuperscriptOffset(nscoord& aResult);
NS_IMETHOD GetSubscriptOffset(nscoord& aResult);
NS_IMETHOD GetWidth(char aC, nscoord& aWidth);
NS_IMETHOD GetWidth(PRUnichar aC, nscoord& aWidth);
NS_IMETHOD GetWidth(const nsString& aString, nscoord& aWidth);