mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-05 16:31:53 +02:00
74 lines
1.2 KiB
C
74 lines
1.2 KiB
C
/*
|
|
* text.c - FIG text object
|
|
*
|
|
* Written 2016 by Werner Almesberger
|
|
* Copyright 2016 by Werner Almesberger
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*/
|
|
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include "fig.h"
|
|
#include "text.h"
|
|
|
|
|
|
void text_init(struct text *txt)
|
|
{
|
|
txt->s = NULL;
|
|
txt->size = 0;
|
|
txt->x = txt->y = 0;
|
|
txt->rot = 0;
|
|
txt->hor = text_mid;
|
|
txt->vert = text_mid;
|
|
}
|
|
|
|
|
|
void text_free(struct text *txt)
|
|
{
|
|
free((void *) txt->s);
|
|
}
|
|
|
|
void text_set(struct text *txt, const char *s)
|
|
{
|
|
free((void *) txt->s);
|
|
txt->s = strdup(s);
|
|
}
|
|
|
|
|
|
void text_fig(struct text *txt, int color, unsigned layer)
|
|
{
|
|
int x = txt->x;
|
|
int y = txt->y;
|
|
|
|
switch (txt->vert) {
|
|
case text_min:
|
|
break;
|
|
case text_mid:
|
|
y += txt->size >> 1;
|
|
break;
|
|
case text_max:
|
|
y += txt->size;
|
|
break;
|
|
default:
|
|
abort();
|
|
}
|
|
fig_text(x, y, txt->s, txt->size, txt->hor, txt->rot, color, layer);
|
|
}
|
|
|
|
|
|
void text_rel_x(struct text *txt, int x, int y)
|
|
{
|
|
}
|
|
|
|
|
|
void text_rel_y(struct text *txt, int x, int y)
|
|
{
|
|
}
|