Ejemplo n.º 1
0
Archivo: font.c Proyecto: manish05/TCR
int main(int argc,char **argv) {
	SDL_Color white={255,255,255,255};
	SDL_Event event;
	SDL_Rect dest;
	int height,width;
	SDL_Init(SDL_INIT_VIDEO);
	TTF_Init();
	window=SDL_CreateWindow("Font",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,
	                        640,400,0);
	renderer=SDL_CreateRenderer(window,-1,0);
	if(!(font=TTF_OpenFont("c:/windows/fonts/times.ttf",40))) return 1;
	SDL_Texture *texture=rendertext("Whee, hello world!",white);
	SDL_QueryTexture(texture,NULL,NULL,&width,&height);
	while(1) {
		while(!SDL_PollEvent(&event)) SDL_Delay(10);
		if(event.type==SDL_QUIT) break;
		if(event.type==SDL_KEYDOWN) break;
		if(event.type==SDL_MOUSEBUTTONDOWN) break;
		SDL_RenderClear(renderer);
		dest.x=(640-width)/2;
		dest.y=(400-height)/2;
		dest.w=width;
		dest.h=height;
		SDL_RenderCopy(renderer,texture,0,&dest);
		SDL_RenderPresent(renderer);
	}
	SDL_DestroyTexture(texture);
	TTF_CloseFont(font);
	SDL_DestroyRenderer(renderer);
	SDL_DestroyWindow(window);
	TTF_Quit();
	SDL_Quit();
	return 0;
}
Ejemplo n.º 2
0
ofxPangoCairo::ofxPangoCairo() {
	surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1024, 768);
	cr = cairo_create(surface);
	
	cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
	cairo_paint(cr);
	
	rendertext(cr);
	
	cairo_destroy(cr);
	status = cairo_surface_write_to_png(surface, ofToDataPath("out.png").c_str());
	cairo_surface_destroy(surface);
	
	if (status != CAIRO_STATUS_SUCCESS) {
		// if 'status' was not set to indicate a successful operation when saving as a png, error
		printf("Could not save to png, \"out.png\"\n");
	}
}
Ejemplo n.º 3
0
char*
loadhtml(int fd)
{
	URLwin *u;
	Bytes *b;
	int n;
	char buf[4096];

	u = emalloc(sizeof(URLwin));
	u->infd = fd;
	u->outfd = 1;
	u->url = estrdup(url);
	u->type = TextHtml;

	b = emalloc(sizeof(Bytes));
	while((n = read(fd, buf, sizeof buf)) > 0)
		growbytes(b, buf, n);
	if(b->b == nil)
		return nil;	/* empty file */
	rendertext(u, b);
	freeurlwin(u);
	return nil;
}
Ejemplo n.º 4
0
int main(int argc,char **argv){
	cairo_t *cr;
	cairo_status_t status;
	cairo_surface *surface;

	surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,300,100);

	cr = cairo_create(surface);

	cairo_set_source_rgb(cr,1.0,1.0,1.0);

	cairo_paint(cr);

	rendertext(cr);

	cairo_destroy(cr);

	status = cairo_surface_write_to_png(surface,"out.png");

	cairo_surface_destroy(surface);

	return 0;
}
Ejemplo n.º 5
0
static fz_error *
rendernode(fz_renderer *gc, fz_node *node, fz_matrix ctm)
{
	if (!node)
		return fz_okay;

	gc->flag = FNONE;
	if (gc->over)
		gc->flag |= FOVER;

	switch (node->kind)
	{
	case FZ_NOVER:
		return renderover(gc, (fz_overnode*)node, ctm);
	case FZ_NMASK:
		return rendermask(gc, (fz_masknode*)node, ctm);
	case FZ_NTRANSFORM:
		return rendertransform(gc, (fz_transformnode*)node, ctm);
	case FZ_NCOLOR:
		return rendersolid(gc, (fz_solidnode*)node, ctm);
	case FZ_NPATH:
		return renderpath(gc, (fz_pathnode*)node, ctm);
	case FZ_NTEXT:
		return rendertext(gc, (fz_textnode*)node, ctm);
	case FZ_NIMAGE:
		return renderimage(gc, (fz_imagenode*)node, ctm);
	case FZ_NSHADE:
		return rendershade(gc, (fz_shadenode*)node, ctm);
	case FZ_NLINK:
		return rendernode(gc, ((fz_linknode*)node)->tree->root, ctm);
	case FZ_NBLEND:
		return fz_okay;
	}

	return fz_okay;
}
Ejemplo n.º 6
0
int main(int argc, char *argv[])
{
	int fbdev,c,option_index;
	unsigned int alpha;
	struct fb_var_screeninfo var;
	struct fb_fix_screeninfo fix;

	/* Check which console we're running on */
	init_consoles();
		
	alpha = 100;
	while (1) {
		static struct option long_options[] = {
			{"help", 0, 0, 'h'},
			{"verbose", 0, 0, 'v'},
			{"alpha", 1, 0, 'a'},
			{"version", 0, 0, 'V'},
			{"start-console",0,0,'S'},
			{"size",1,0,'s'},
			{"console",1,0,'c'}, 
			{"font",1,0,'f'}, 
			{"textcolor",1,0,'t'}, 
			{0, 0, 0, 0}
		};

		c = getopt_long(argc, argv, "a:x:y:h?vVSc:f:t:s:",
				long_options, &option_index);

		if (c == -1)
			break;

		switch (c) {
		case 'a':
			alpha = atoi(optarg);
			if (alpha > 100)
				alpha = 100;
			break;
		case 'x':
			fbxpos = atoi(optarg);
			break;
		case 'y':
			fbypos = atoi(optarg);
			break;
		case '?':
		case 'h':
			usage(argv[0]);
			exit(0);
		case 'v':
			verbose = 1;
			break;
		case 'V':
			version();
			exit(0);
		case 'c':
			start_console=atoi(optarg)-1;
		case 'S':
			sconly=1;
			break;
		case 'f':
			strict_font=1;
			font=strdup(optarg);
			break;
		case 't':
			fgcolor=strtol(optarg, NULL, 16);
			break;
		case 's':
			fontsize=strtol(optarg, NULL, 10);
			break;

		default:
			break;
		}
	}
	if (optind >= argc) {
		printf("No text\n");
		exit(0);
	}
	
	/* Initialize framebuffer */
        fbdev = open("/dev/fb/0", O_RDWR);
        if (fbdev < 0) {
 		fbdev = open("/dev/fb0", O_RDWR);
		if (fbdev < 0) {
			fprintf(stderr, "error while opening framebuffer.\n");
			exit(fbdev);
		}
	}

	ioctl(fbdev, FBIOGET_VSCREENINFO, &var);
	fbbytes = var.bits_per_pixel>>3;
	fbx=var.xres; 
	fby=var.yres;
	ioctl(fbdev, FBIOGET_FSCREENINFO, &fix);
	fblinelen = fix.line_length;

	framebuffer = mmap(NULL,  fblinelen* fby ,
		 PROT_WRITE | PROT_READ, MAP_SHARED, fbdev, var.yoffset * fblinelen);

	rendertext (argv[optind], font, fontsize, fgcolor);
	return 0;
}
Ejemplo n.º 7
0
Archivo: main.c Proyecto: cpehle/chalk
int kernel_main() {
  ConsoleDesc cd = {0, 0xf0, (unsigned short *)0xb8000};
  Console c = &cd;
  cclear(c,0xff);

  {
    const u16 com1 = 0x3f8;
    outb(com1 + 1, 0x00);    // Disable all interrupts
    outb(com1 + 3, 0x80);    // Enable DLAB (set baud rate divisor)
    outb(com1 + 0, 0x03);    // Set divisor to 3 (lo byte) 38400 baud
    outb(com1 + 1, 0x00);    //                  (hi byte)
    outb(com1 + 3, 0x03);    // 8 bits, no parity, one stop bit
    outb(com1 + 2, 0xC7);    // Enable FIFO, clear them, with 14-byte threshold
    outb(com1 + 4, 0x0B);    // IRQs enabled, RTS/DSR set
    if (0) {
    for (;;) {
      if(inb(com1 + 5) & 1) {
        char ch = inb(com1);
        cputc(c, ch);
      }
    }
    }

  }

  pciscan(c); // This is to test pci traversal.
  // Ethernet
  if (0) {
    PciConf eth = pciconfread(0, 3);
    cprintpciconf(c, eth);
    e1000init(0, &eth, c);
  }
  // for (;;);

  // Instead of a proper memory allocator we just allocate permanently
  // from one large Arena, this is only a temporary solution.
  // Eventually we want to guarantee that processes and tasks get
  // different arenas with potential overlap in a single address
  // space.
  Arena* a;
  arenainit(a, 1000*1000*1000*sizeof(u8), (void *)0x100000);
  // Functions that need to allocate memory need to be passed a memory
  // arena as part of their execution context.

  // initialize all known hardware, so far there is no dynamic device
  // discovery, instead we hardcode the locations of the devices on
  // the pci bus

  // AcpiDesc acpi = {};
  // acpiinit(&acpi, c);

  // nvme
  if (0) {
    PciConf conf = pciconfread(0,3);
    cprintpciconf(c, conf);
    nvmepciinit(a, c, conf);
  }

  // Ahci code doesn't work yet.
  // ahcipciinit(a, c, 0, 4);

  // Eventually we want to enable all CPU features found during detection.
  cpudetect(c);

  {
    M44 m = (M44){1,1,0,0,
                  0,1,0,0,
                  0,0,1,0,
                  0,0,0,1};
    V4 v = {1,
            0,
            0,
            0};
    V4 w = {0,
            1,
            0,
            0};
    V4 u = v4avv(v, w);
    cprintv4(c, u);
    cprintv4(c, v4msv(2, u));
    cprintv4(c, v4mmv(m44i(), u));
    cprintm44(c, m44i());
    cprintm44(c, v4msm(2, m44i()));
    cprintm44(c, v4mmm(v4msm(2, m44i()), m44i()));
    cprintm44(c, v4mmm(m, m));
  }

  for (;;);
  // Graphics only work with bochs emulator
  {
    u32 *framebufferaddr;
    {
       // 0x1234:0x1111
      PciConf vesa = pciconfread(0, 2);
      framebufferaddr = (u32 *)vesa.dev.base_address_register[0].address;
    }
    vbeset(1920, 1200, 32);
    int offset = 0;
// clear the screen to light grey
    for (int i = 0; i < 1920; ++i) {
      for (int j = 0; j<1200; ++j) {
      offset = (j * 1920 + i);
      // Format is 0x00rrggbb, can use first byte for alpha blending / z-buffering
      framebufferaddr[offset] = 0x00eeeeee;
      }
    }
    // draw a "line"
    for (int i = 0; i < 1920; ++i) {
      offset = (50 * 1920 + i);
      // Format is 0x00rrggbb, can use first byte for alpha blending
      framebufferaddr[offset] = 0x00ff0000;
    }


    {
      float t = 0;
      BezierData b = {
          4,
          {{50, 68, 0, 0}, {70, 220, 0, 0}, {80, 40, 0, 0}, {90, 100, 0, 0}}};
      while (t < 1) {
        V4 v = evcubicbezier(b, t);
        int offset = (u32)(v.v[1]) * 1920 + (u32)(v.v[0]);
        framebufferaddr[offset] = 0x000000ff;
        t += 0.00001;
      }
    }
    {
      float t = 0;
      BezierData b = {
        4,
        {{10, 20, 0, 0}, {70, 10, 0, 0}, {80, 40, 0, 0}, {90, 100, 0, 0}}};
      while (t < 1) {
        V4 v = evcubicbezier(b, t);
        int offset = (u32)(v.v[1]) * 1920 + (u32)(v.v[0]);
        framebufferaddr[offset] = 0x0000ff00;
        t += 0.00001;
      }
    }
    for (;;);
    u32* buf = renderglyphs(a);
    copyrect(framebufferaddr, buf, 0, 20, 98);
    rendertext(framebufferaddr, buf, "Hello World.", 0, 50);
    rendertext(framebufferaddr, buf, "Hello World.", 0, 66);
    rendertext(framebufferaddr, buf, "This is a test.", 0, 96);
    rendertext(framebufferaddr, buf, "Hello World.", 8*20, 82);
    rendertext(framebufferaddr, buf, "12 23 45 332", 8*20, 60*16);
  }
  for (;;) {}
}
Ejemplo n.º 8
0
static fz_error *
rendermask(fz_renderer *gc, fz_masknode *mask, fz_matrix ctm)
{
	fz_error *error;
	int oldmaskonly;
	fz_pixmap *oldover;
	fz_irect oldclip;
	fz_irect bbox;
	fz_irect clip;
	fz_pixmap *shapepix = nil;
	fz_pixmap *colorpix = nil;
	fz_node *shape;
	fz_node *color;
	float rgb[3];

	shape = mask->super.first;
	color = shape->next;

	/* special case black voodo */
	if (gc->flag & FOVER)
	{
		if (fz_issolidnode(color))
		{
			fz_solidnode *solid = (fz_solidnode*)color;

			fz_convertcolor(solid->cs, solid->samples, gc->model, rgb);
			gc->argb[0] = solid->a * 255;
			gc->argb[1] = rgb[0] * solid->a * 255;
			gc->argb[2] = rgb[1] * solid->a * 255;
			gc->argb[3] = rgb[2] * solid->a * 255;
			gc->argb[4] = rgb[0] * 255;
			gc->argb[5] = rgb[1] * 255;
			gc->argb[6] = rgb[2] * 255;
			gc->flag |= FRGB;

			/* we know these can handle the FRGB shortcut */
			if (fz_ispathnode(shape))
				return renderpath(gc, (fz_pathnode*)shape, ctm);
			if (fz_istextnode(shape))
				return rendertext(gc, (fz_textnode*)shape, ctm);
			if (fz_isimagenode(shape))
				return renderimage(gc, (fz_imagenode*)shape, ctm);
		}
	}

	oldclip = gc->clip;
	oldover = gc->over;

	bbox = fz_roundrect(fz_boundnode(shape, ctm));
	clip = fz_intersectirects(bbox, gc->clip);
	bbox = fz_roundrect(fz_boundnode(color, ctm));
	clip = fz_intersectirects(bbox, clip);

	if (fz_isemptyrect(clip))
		return fz_okay;

DEBUG("mask [%d %d %d %d]\n{\n", clip.x0, clip.y0, clip.x1, clip.y1);

{
fz_irect sbox = fz_roundrect(fz_boundnode(shape, ctm));
fz_irect cbox = fz_roundrect(fz_boundnode(color, ctm));
if (cbox.x0 >= sbox.x0 && cbox.x1 <= sbox.x1)
if (cbox.y0 >= sbox.y0 && cbox.y1 <= sbox.y1)
DEBUG("potentially useless mask\n");
}

	gc->clip = clip;
	gc->over = nil;

	oldmaskonly = gc->maskonly;
	gc->maskonly = 1;

	error = rendernode(gc, shape, ctm);
	if (error)
		goto cleanup;
	shapepix = gc->dest;
	gc->dest = nil;

	gc->maskonly = oldmaskonly;

	error = rendernode(gc, color, ctm);
	if (error)
		goto cleanup;
	colorpix = gc->dest;
	gc->dest = nil;

	gc->clip = oldclip;
	gc->over = oldover;

	if (shapepix && colorpix)
	{
		if (gc->over)
		{
			blendmask(gc, colorpix, shapepix, gc->over, 1);
		}
		else
		{
			clip.x0 = MAX(colorpix->x, shapepix->x);
			clip.y0 = MAX(colorpix->y, shapepix->y);
			clip.x1 = MIN(colorpix->x+colorpix->w, shapepix->x+shapepix->w);
			clip.y1 = MIN(colorpix->y+colorpix->h, shapepix->y+shapepix->h);
			error = fz_newpixmapwithrect(&gc->dest, clip, colorpix->n);
			if (error)
				goto cleanup;
			blendmask(gc, colorpix, shapepix, gc->dest, 0);
		}
	}

DEBUG("}\n");

	if (shapepix) fz_droppixmap(shapepix);
	if (colorpix) fz_droppixmap(colorpix);
	return fz_okay;

cleanup:
	if (shapepix) fz_droppixmap(shapepix);
	if (colorpix) fz_droppixmap(colorpix);
	return error;
}
Ejemplo n.º 9
0
int main(int argc, char** argv)
{
	cairo_t *cr;
	cairo_status_t status;
	cairo_surface_t *surface;
	//FT_Bitmap bmp = {0};

	int stride = 0;
	int width = 640;
	int height = 480;



	bool ok = FcConfigAppFontAddFile(NULL, (FcChar8*)"fonts/ComicSansAfrica.ttf");
	if (!ok)
	{
		printf("Failed to load ComicSansAfrica.ttf\n");
	}

	FcChar8 *configName = FcConfigFilename(NULL);
	printf("%s", (const char*)configName);
	printf("\n");

	FcConfig* config = FcConfigCreate();
	FcConfigParseAndLoad(config, configName, true);
	FcConfigSetCurrent(config);

	/* FT buffer */
	//FT_Bitmap_New(&bmp);
	//bmp.rows = height;
	//bmp.width = width;

	//bmp.buffer = (unsigned char*)malloc(bmp.rows * bmp.width * 4);
	// if (NULL == bmp.buffer)
	// {
	// 	printf("+ error: cannot allocate the buffer for the output bitmap.\n");
	// 	exit(EXIT_FAILURE);
	// }

	//bmp.pitch = ((width+3) & -4) * 4;
	//bmp.pixel_mode = FT_PIXEL_MODE_BGRA;

	//printf("%d\n", bmp.pitch);

	//stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width);
	//printf("%d\n", stride);

	//surface = cairo_image_surface_create_for_data(bmp.buffer, CAIRO_FORMAT_ARGB32, width, height, stride);
	surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
	if (CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) {
		printf("+ error: couldn't create the surface.\n");
		exit(EXIT_FAILURE);
	}
	cr = cairo_create(surface);
	if (CAIRO_STATUS_NO_MEMORY == cairo_status(cr)) {
		printf("+ error: out of memory, cannot create cairo_t*\n");
		exit(EXIT_FAILURE);
	}


	cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 1.0);
	cairo_paint(cr);

	rendertext(cr);


	status = cairo_surface_write_to_png(surface, "out.png");
	cairo_surface_destroy(surface);
	cairo_destroy(cr);

	return 0;
}
Ejemplo n.º 10
0
int main(int argc, char *argv[])
{
  	char textstr[4096];
  	char ** line;
  	int * len;
  	int lines;
  	int i;
	int fbdev,c,option_index;
	unsigned int alpha;
	ssize_t read(int fd, void *buf, size_t count);

	struct fb_var_screeninfo var;
	struct fb_fix_screeninfo fix;

	/* Initialize consoles */
	init_consoles();
		
	alpha = 100;
	while (1) {
		static struct option long_options[] = {
            		{"help", no_argument, 0, 'h'},
			{"version", no_argument, 0, 'V'},
			{"info", no_argument, 0, 'i'},
			{"zygote", no_argument, 0, 'z'},
			{"power", no_argument, 0, 'p'},
			{"clear", no_argument, 0, 'c'},
			{"brightness", required_argument, 0, 'b'},
			{"boxwidth", required_argument, 0, 'w'},
			{"font", required_argument, 0, 'f'},
			{"size", required_argument, 0, 's'},
			{"textcolor", required_argument, 0, 't'},
			{"alpha", required_argument, 0, 'a'},
			{0, 0, 0, 0}
		};

		c = getopt_long(argc, argv, ":x:y:h?Vizpcb:w:f:s:t:a:",
				long_options, &option_index);

		if (c == -1)
			break;

		switch (c) {
		case 'x':
			fbxpos = atoi(optarg);
			break;
		case 'y':
			fbypos = atoi(optarg);
			break;
		case '?':
		case 'h':
			usage(argv[0]);
			exit(0);
		case 'V':
			version();
			exit(0);
		case 'i':
			display_info();
			exit(0);
		case 'z':
			if (optind >= argc) {
				printf("No text\n");
				exit(0);
			}
			printf("Zygote Mode.\n");
			printf("Waiting for display to sleep...\n");
			wait_sleep();
			power_display();
			set_brightness(brightness,blen);
			wait_wake();
			clear_display();
			break;
		case 'p':
			power_key();
			exit(0);
		case 'c':
			clear_display();
			printf("Device display cleared.\n");
			exit(0);
		case 'b':
			brightness = atoi(optarg);
			if (brightness > 100 && brightness <= 255 ) {
				blen = 3;
			} else if (brightness <= 99 && brightness >= 10 ) {
				blen = 2;
			} else if (brightness <= 9 && brightness >= 0 ) {
				blen = 1;
			}
			break;
		case 'w':
			boxwidth = atoi(optarg);
			break;
		case 'f':
			strict_font=1;
			font=strdup(optarg);
			break;
		case 's':
			fontsize=strtol(optarg, NULL, 10);
			break;
		case 't':
			if (strlen(optarg) != 6) {
    				printf("Invalid color!\n");
				exit(0);
    			}
			fontcolor=strtol(optarg, NULL, 16);
			break;
		case 'a':
			alpha = atoi(optarg);
			if (alpha > 100)
				alpha = 100;
			break;
		default:
			break;
		}
	}
	if (optind >= argc) {
		printf("No text\n");
		exit(0);
	}
	
	
	// Power on display
	power_display();

	// Set the brightness
	set_brightness(brightness,blen);

	// Initialize framebuffer
        fbdev = open("/dev/graphics/fb0", O_RDWR);
        if (fbdev < 0) {
			fprintf(stderr, "Error opening framebuffer on device.\n");
			exit(fbdev);
	}

	ioctl(fbdev, FBIOGET_VSCREENINFO, &var);
	fbbytes = var.bits_per_pixel>>3;
	fbx=var.xres; 
	fby=var.yres;
	ioctl(fbdev, FBIOGET_FSCREENINFO, &fix);
	fblinelen = fix.line_length;
	fbyposoff = fbypos;

	lines = strwrap(argv[optind], boxwidth, &line, &len);
	  for (i = 0; i < lines; i++)
	  {
	    if (i > 0)
	    {
	    fbypos += fontsize;
	    }
	    if (fbypos + fontsize >= fby - fbyposoff)
    	    {
    	      exit(0);
    	    }
	    strncpy(textstr, line[i], len[i]);
	    textstr[len[i]] = '\0';
	     	//printf("%4d |%-*s|\n", len[i], boxwidth, argv[optind]);
	    framebuffer = mmap(NULL,  fblinelen* fby ,
		 PROT_WRITE | PROT_READ, MAP_SHARED, fbdev, var.yoffset * fblinelen);
	    rendertext (("%s", len[i], boxwidth, textstr), font, fontsize, reverse(fontcolor));
	  }

	free(line);
	free(len);
	return 0;
}
Ejemplo n.º 11
0
void DispSubsByPosition(gint64 position, CustomData *data)
{
    char curTotlaTime[40], curMin[5], curSec[5], curenthours[5], milsectimeBuf[5];
    char endTImeLine[100] = "--> ";    
    guint milSec = 9999999;
    milSec = position / GST_MSECOND;
    guint sec = ((milSec % (1000*60*60)) % (1000*60)) / 1000;
    guint min = (milSec % (1000*60*60)) / (1000*60);
    guint hours = milSec / (1000 * 60 * 60);
    guint milsec2 = ((position / GST_MSECOND) % 1000) / 10;

    sprintf(curenthours, "0%d", hours);

    if(sec < 10)
    {
        sprintf(curSec, "0%d", sec);
    }
    else
    {
        sprintf(curSec, "%d", sec);
	}
	
    if(min < 10)
    {
        sprintf(curMin, "0%d", min);
    }
    else
    {
        sprintf(curMin, "%d", min);
    }

    if(milsec2 < 10)
    {
        sprintf(milsectimeBuf, "0%d", milsec2);
    }
    else
    {
        sprintf(milsectimeBuf, "%d", milsec2);
    }

    if(data->IsSubtitlesLoaded)
    {
        curTotlaTime[0] = 0;
        strcat(curTotlaTime, curenthours);
        strcat(curTotlaTime, ":");
        strcat(curTotlaTime, curMin);
        strcat(curTotlaTime, ":");
        strcat(curTotlaTime, curSec);
        strcat(curTotlaTime, ":");
        strcat(curTotlaTime, milsectimeBuf);
        strcat(endTImeLine, curTotlaTime);
                
        int Hresult;
        hm_get(data->hm, curTotlaTime, data->Hbuf, sizeof(data->Hbuf));

        if(hm_exists(data->hm, curTotlaTime))
        {
            Hresult = hm_get(data->hm, curTotlaTime, data->Hbuf, sizeof(data->Hbuf));
            if(Hresult == 0)
            {
                g_error("Value from hash table not found");
            }

            ClearSubsWindow(data);//Clear subtitles window before new text render
            rendertext(data, data->subs_window);
            g_print("%s", data->Hbuf);
        }
        else if(hm_exists(data->hm, endTImeLine))
        {
            //We have to use ClearSubsWindow twise to clear subs window
            ClearSubsWindow(data);
            strcpy(data->Hbuf, "1");//Must have a string and not an empty one neither spase
            rendertext(data, data->subs_window);
            ClearSubsWindow(data);
        }
    }
}