Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsType1.h File Reference
#include <stdio.h>
#include "nspr.h"
#include "nsIFreeType2.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define T1_HSTEM   1 /* 0x01 */
#define T1_VSTEM   3 /* 0x03 */
#define T1_VMOVETO   4 /* 0x04 */
#define T1_RLINETO   5 /* 0x05 */
#define T1_HLINETO   6 /* 0x06 */
#define T1_VLINETO   7 /* 0x07 */
#define T1_RRCURVETO   8 /* 0x08 */
#define T1_CLOSEPATH   9 /* 0x09 */
#define T1_CALLSUBR   10 /* 0x0a */
#define T1_RETURN   11 /* 0x0b */
#define T1_ESC_CMD   12 /* 0x0c */
#define T1_HSBW   13 /* 0x0d */
#define T1_ENDCHAR   14 /* 0x0e */
#define T1_RMOVETO   21 /* 0x15 */
#define T1_HMOVETO   22 /* 0x16 */
#define T1_VHCURVETO   30 /* 0x1e */
#define T1_HVCURVETO   31 /* 0x1f */
#define T1_ESC_SBW   7 /* 0x07 */
#define TYPE1_ENCRYPTION_KEY   4330
#define TYPE1_ENCRYPTION_C1   52845
#define TYPE1_ENCRYPTION_C2   22719

Functions

int toCS (double upm, double x)
int fromCS (double upm, double x)
FT_Error FT2GlyphToType1CharString (nsIFreeType2 *aFt2, FT_Face aFace, PRUint32 aGlyphID, int aWmode, int aLenIV, unsigned char *aBuf)
PRBool FT2SubsetToType1FontSet (FT_Face aFace, const nsString &aSubset, int aWmode, FILE *aFile)
nsresult FT2ToType1FontName (FT_Face aFace, int aWmode, nsCString &aFontName)

Define Documentation

#define T1_CALLSUBR   10 /* 0x0a */

Definition at line 88 of file nsType1.h.

#define T1_CLOSEPATH   9 /* 0x09 */

Definition at line 87 of file nsType1.h.

#define T1_ENDCHAR   14 /* 0x0e */

Definition at line 92 of file nsType1.h.

#define T1_ESC_CMD   12 /* 0x0c */

Definition at line 90 of file nsType1.h.

#define T1_ESC_SBW   7 /* 0x07 */

Definition at line 99 of file nsType1.h.

#define T1_HLINETO   6 /* 0x06 */

Definition at line 84 of file nsType1.h.

#define T1_HMOVETO   22 /* 0x16 */

Definition at line 94 of file nsType1.h.

#define T1_HSBW   13 /* 0x0d */

Definition at line 91 of file nsType1.h.

#define T1_HSTEM   1 /* 0x01 */

Definition at line 80 of file nsType1.h.

#define T1_HVCURVETO   31 /* 0x1f */

Definition at line 96 of file nsType1.h.

#define T1_RETURN   11 /* 0x0b */

Definition at line 89 of file nsType1.h.

#define T1_RLINETO   5 /* 0x05 */

Definition at line 83 of file nsType1.h.

#define T1_RMOVETO   21 /* 0x15 */

Definition at line 93 of file nsType1.h.

#define T1_RRCURVETO   8 /* 0x08 */

Definition at line 86 of file nsType1.h.

#define T1_VHCURVETO   30 /* 0x1e */

Definition at line 95 of file nsType1.h.

#define T1_VLINETO   7 /* 0x07 */

Definition at line 85 of file nsType1.h.

#define T1_VMOVETO   4 /* 0x04 */

Definition at line 82 of file nsType1.h.

#define T1_VSTEM   3 /* 0x03 */

Definition at line 81 of file nsType1.h.

Definition at line 102 of file nsType1.h.

Definition at line 103 of file nsType1.h.

Definition at line 101 of file nsType1.h.


Function Documentation

int fromCS ( double  upm,
double  x 
) [inline]

Definition at line 74 of file nsType1.h.

{
  return (int) (x*upm/1000.0);
}

Here is the caller graph for this function:

FT_Error FT2GlyphToType1CharString ( nsIFreeType2 aFt2,
FT_Face  aFace,
PRUint32  aGlyphID,
int  aWmode,
int  aLenIV,
unsigned char *  aBuf 
)

Definition at line 416 of file nsType1.cpp.

{
  int j;
  FT_Int32 flags = FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
  FT_GlyphSlot slot;
  unsigned char *start = aBuf;
  FT2PT1_info fti;

#ifdef MOZ_ENABLE_XFT
  FT_Error error = FT_Load_Glyph(aFace, aGlyphID, flags);
  if (error) {
    NS_ERROR("failed to load aGlyphID");
    return error;
  }
#else
  nsresult rv = aFt2->LoadGlyph(aFace, aGlyphID, flags);
  if (NS_FAILED(rv)) {
    NS_ERROR("failed to load aGlyphID");
    return 1;
  }
#endif
  slot = aFace->glyph;

  if (slot->format != ft_glyph_format_outline) {
    NS_ERROR("aGlyphID is not an outline glyph");
    return 1;
  }

#ifdef MOZ_ENABLE_FREETYPE2
  fti.ft2     = aFt2;
#endif
  fti.face    = aFace;
  fti.buf     = aBuf;
  fti.elm_cnt = 0;
  fti.len     = 0;
  fti.wmode   = aWmode;

  /* add space for "random" bytes */
  for (j=0; j< aLenIV; j++) {
    fti.len += ecsi(&fti.buf, 0);
  }
#ifdef MOZ_ENABLE_XFT
  if (FT_Outline_Decompose(&slot->outline, &ft_outline_funcs, &fti))  {
    NS_ERROR("error decomposing aGlyphID");
    return 1;
  }
#else
  rv = aFt2->OutlineDecompose(&slot->outline, &ft_outline_funcs, &fti);
  if (NS_FAILED(rv)) {
    NS_ERROR("error decomposing aGlyphID");
    return 1;
  }
#endif

  if (fti.elm_cnt) {
    fti.len += csc(&fti.buf, T1_CLOSEPATH);
    fti.len += csc(&fti.buf, T1_ENDCHAR);
  }
  else {
    FT_Vector end_pt;
    end_pt.x = 0;
    end_pt.y = 1; /* dummy value to cause sbw instead of hsbw */
    PRBool rslt = sideWidthAndBearing(&end_pt, &fti);
    if (rslt != PR_TRUE) {
      return 1;
    }
    fti.len += csc(&fti.buf, T1_ENDCHAR);
  }
  if (fti.buf) {
    Type1EncryptString(start, start, fti.len);
  }

  return fti.len;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool FT2SubsetToType1FontSet ( FT_Face  aFace,
const nsString aSubset,
int  aWmode,
FILE aFile 
)

Definition at line 515 of file nsType1.cpp.

{
#ifdef MOZ_ENABLE_FREETYPE2
  nsresult rv; 
  nsCOMPtr<nsIFreeType2> ft2 = do_GetService(NS_FREETYPE2_CONTRACTID, &rv);
  if (NS_FAILED(rv)) {
    NS_ERROR("Failed to get nsIFreeType2 service");
    return PR_FALSE;
  }
#endif

  nsCAutoString fontNameBase;
  FT2ToType1FontName(aFace, aWmode, fontNameBase);
  PRUint32 i = 0;
  for (; i <= aSubset.Length() / 255 ; i++) {
    nsCAutoString fontName(fontNameBase);
    fontName.AppendLiteral(".Set");
    fontName.AppendInt(i);
#ifdef MOZ_ENABLE_XFT
    outputType1SubFont(aFace,
#else
    outputType1SubFont(ft2, aFace, 
#endif
      Substring(aSubset, i * 255, PR_MIN(255, aSubset.Length() - i * 255)),
      fontName.get(), aWmode, 4, aFile);
  }
  return PR_TRUE;
}

Here is the call graph for this function:

nsresult FT2ToType1FontName ( FT_Face  aFace,
int  aWmode,
nsCString aFontName 
)

Definition at line 503 of file nsType1.cpp.

{
  aFontName = aFace->family_name;
  aFontName.AppendLiteral(".");
  aFontName += aFace->style_name;
  aFontName += nsPrintfCString(".%ld.%d", aFace->face_index, aWmode ? 1 : 0);
  flattenName(aFontName);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int toCS ( double  upm,
double  x 
) [inline]

Definition at line 68 of file nsType1.h.

{
  return (int)((x*1000.0)/upm);
}

Here is the caller graph for this function: