示例#1
0
static int
FontSave (int argc, char **argv, Coord Ux, Coord Uy) {
    FontType *font;
    SymbolType *symbol;
    int i;
    GList *ii;
    LayerType *lfont, *lwidth;
    font = &PCB->Font;
    lfont = PCB->Data->Layer + 0;
    lwidth = PCB->Data->Layer + 2;

    for (i = 0; i <= MAX_FONTPOSITION; i++) {
        font->Symbol[i].LineN = 0;
        font->Symbol[i].Valid = 0;
        font->Symbol[i].Width = 0;
    }

    for (ii = lfont->Line; ii != NULL; ii = g_list_next (ii)) {
        LineType *l = ii->data;
        int x1 = l->Point1.X;
        int y1 = l->Point1.Y;
        int x2 = l->Point2.X;
        int y2 = l->Point2.Y;
        int ox, oy, s;
        s = XYtoSym (x1, y1);
        ox = (s % 16 + 1) * CELL_SIZE;
        oy = (s / 16 + 1) * CELL_SIZE;
        symbol = &PCB->Font.Symbol[s];
        x1 -= ox;
        y1 -= oy;
        x2 -= ox;
        y2 -= oy;

        if (symbol->Width < x1) {
            symbol->Width = x1;
        }

        if (symbol->Width < x2) {
            symbol->Width = x2;
        }

        symbol->Valid = 1;
        CreateNewLineInSymbol (symbol, x1, y1, x2, y2, l->Thickness);
    }

    for (ii = lwidth->Line; ii != NULL; ii = g_list_next (ii)) {
        LineType *l = ii->data;
        Coord x1 = l->Point1.X;
        Coord y1 = l->Point1.Y;
        Coord ox, s;
        s = XYtoSym (x1, y1);
        ox = (s % 16 + 1) * CELL_SIZE;
        symbol = &PCB->Font.Symbol[s];
        x1 -= ox;
        symbol->Delta = x1 - symbol->Width;
    }

    SetFontInfo (font);
    return 0;
}
示例#2
0
static int
FontSave (int argc, char **argv, int Ux, int Uy)
{
  FontTypePtr font;
  SymbolTypePtr symbol;
  int i;
  LayerTypePtr lfont, lwidth;

  font = &PCB->Font;
  lfont = PCB->Data->Layer + 0;
  lwidth = PCB->Data->Layer + 2;

  for (i = 0; i <= MAX_FONTPOSITION; i++)
    {
      font->Symbol[i].LineN = 0;
      font->Symbol[i].Valid = 0;
      font->Symbol[i].Width = 0;
    }

  for (i = 0; i < lfont->LineN; i++)
    {
      LineTypePtr l = &lfont->Line[i];
      int x1 = l->Point1.X;
      int y1 = l->Point1.Y;
      int x2 = l->Point2.X;
      int y2 = l->Point2.Y;
      int ox, oy, s;

      s = XYtoSym (x1, y1);
      ox = (s % 16 + 1) * CELL_SIZE;
      oy = (s / 16 + 1) * CELL_SIZE;
      symbol = &PCB->Font.Symbol[s];

      x1 -= ox;
      y1 -= oy;
      x2 -= ox;
      y2 -= oy;

      if (symbol->Width < x1)
	symbol->Width = x1;
      if (symbol->Width < x2)
	symbol->Width = x2;
      symbol->Valid = 1;

      CreateNewLineInSymbol (symbol, x1, y1, x2, y2, l->Thickness);
    }

  for (i = 0; i < lwidth->LineN; i++)
    {
      LineTypePtr l = &lwidth->Line[i];
      int x1 = l->Point1.X;
      int y1 = l->Point1.Y;
      int ox, oy, s;

      s = XYtoSym (x1, y1);
      ox = (s % 16 + 1) * CELL_SIZE;
      oy = (s / 16 + 1) * CELL_SIZE;
      symbol = &PCB->Font.Symbol[s];

      x1 -= ox;

      symbol->Delta = x1 - symbol->Width;
    }

  SetFontInfo (font);
  
  return 0;
}