Lines Matching defs:tri
436 \param tri pointer to the TR_INFO structure holding all TR data
441 double TR_baseline(TR_INFO *tri, int src, double *ymax, double *ymin){
448 CX_INFO *cxi=tri->cxi;
449 BR_INFO *bri=tri->bri;
450 TP_INFO *tpi=tri->tpi;
451 FT_INFO *fti=tri->fti;
500 baseline = TR_baseline(tri, trec, ymax, ymin);
522 \param tri pointer to the TR_INFO structure holding all TR data
529 int TR_check_set_vadvance(TR_INFO *tri, int src, int lines){
531 CX_INFO *cxi = tri->cxi;
532 TP_INFO *tpi = tri->tpi;
544 prevbase = TR_baseline(tri, dst, NULL, &ymin);
545 thisbase = TR_baseline(tri, src, &ymax, NULL);
686 \param tri pointer to the TR_INFO structure.
706 \param tri pointer to the TR_INFO structure.
825 \param tri pointer to the TR_INFO structure.
1111 \param tri pointer to the TR_INFO structure.
1113 void cxinfo_dump(const TR_INFO *tri){
1115 CX_INFO *cxi = tri->cxi;
1116 BR_INFO *bri = tri->bri;
1117 TP_INFO *tpi = tri->tpi;
1126 printf("cxi xy: %f , %f\n",tri->x,tri->y);
1518 TR_INFO *trinfo_init(TR_INFO *tri){
1519 if(tri)return(tri); /* tri is already set, double initialization is not allowed */
1520 if(!(tri = (TR_INFO *)calloc(1,sizeof(TR_INFO))) ||
1521 !(tri->fti = ftinfo_init()) ||
1522 !(tri->tpi = tpinfo_init()) ||
1523 !(tri->bri = brinfo_init()) ||
1524 !(tri->cxi = cxinfo_init())
1525 ){ tri = trinfo_release(tri); }
1526 tri->out = NULL; /* This will allocate as needed, it might not ever be needed. */
1527 tri->qe = 0.0;
1528 tri->esc = 0.0;
1529 tri->x = DBL_MAX;
1530 tri->y = DBL_MAX;
1531 tri->dirty = 0;
1532 tri->use_kern = 1;
1533 tri->load_flags = FT_LOAD_NO_SCALE;
1534 tri->kern_mode = FT_KERNING_UNSCALED;
1535 tri->outspace = 0;
1536 tri->outused = 0;
1537 tri->usebk = BKCLR_NONE;
1538 memset(&(tri->bkcolor),0,sizeof(TRCOLORREF));
1539 return(tri);
1546 use like: tri = trinfo_release(tri);
1547 \param tri pointer to the TR_INFO structure.
1550 TR_INFO *trinfo_release(TR_INFO *tri){
1551 if(tri){
1552 if(tri->bri)tri->bri=brinfo_release(tri->bri);
1553 if(tri->tpi)tri->tpi=tpinfo_release(tri->tpi);
1554 if(tri->fti)tri->fti=ftinfo_release(tri->fti);
1555 if(tri->cxi)tri->cxi=cxinfo_release(tri->cxi);
1556 if(tri->out){ free(tri->out); tri->out=NULL; };
1557 free(tri);
1567 use like: tri = trinfo_release_except_FC(tri);
1568 \param tri pointer to the TR_INFO structure.
1571 TR_INFO *trinfo_release_except_FC(TR_INFO *tri){
1572 if(tri){
1573 if(tri->bri)tri->bri=brinfo_release(tri->bri);
1574 if(tri->tpi)tri->tpi=tpinfo_release(tri->tpi);
1575 if(tri->fti)tri->fti=ftinfo_clear(tri->fti);
1576 if(tri->cxi)tri->cxi=cxinfo_release(tri->cxi);
1577 if(tri->out){ free(tri->out); tri->out=NULL; };
1578 free(tri);
1588 Use like: tri = trinfo_clear(tri);
1589 \param tri pointer to the TR_INFO structure.
1592 TR_INFO *trinfo_clear(TR_INFO *tri){
1593 if(tri){
1595 if(tri->bri)tri->bri=brinfo_release(tri->bri);
1596 if(tri->tpi)tri->tpi=tpinfo_release(tri->tpi);
1597 if(tri->cxi)tri->cxi=cxinfo_release(tri->cxi);
1598 if(tri->out){
1599 free(tri->out);
1600 tri->out = NULL;
1601 tri->outused = 0;
1602 tri->outspace = 0;
1605 tri->esc = 0.0;
1606 tri->x = DBL_MAX;
1607 tri->y = DBL_MAX;
1608 tri->dirty = 0;
1609 if(!(tri->tpi = tpinfo_init()) || /* re-init the pieces just released */
1610 !(tri->bri = brinfo_init()) ||
1611 !(tri->cxi = cxinfo_init())
1613 tri = trinfo_release(tri); /* something horrible happened, clean out tri and return NULL */
1616 return(tri);
1629 \param tri pointer to TR_INFO structure
1632 int trinfo_load_qe(TR_INFO *tri, double qe){
1633 if(!tri)return(1);
1635 tri->qe=qe;
1644 \param tri pointer to TR_INFO structure
1648 int trinfo_load_bk(TR_INFO *tri, int usebk, TRCOLORREF bkcolor){
1650 if(!tri){ status = 1; }
1654 status = trinfo_check_bk(tri, usebk, bkcolor);
1655 tri->usebk = usebk;
1656 tri->bkcolor = bkcolor;
1665 \param tri pointer to TR_INFO structure
1669 int trinfo_check_bk(TR_INFO *tri, int usebk, TRCOLORREF bkcolor){
1671 if( (tri->usebk != usebk) || memcmp(&tri->bkcolor,&bkcolor,sizeof(TRCOLORREF))){ status = -1; }
1678 \param tri pointer to a TR_INFO structure
1686 int trinfo_load_ft_opts(TR_INFO *tri, int use_kern, int load_flags, int kern_mode){
1687 if(!tri)return(1);
1688 tri->use_kern = use_kern;
1689 tri->load_flags = load_flags;
1690 tri->kern_mode = kern_mode;
1697 \param tri pointer to a TR_INFO structure
1700 int trinfo_append_out(TR_INFO *tri, const char *src){
1705 if(tri->outused + (int) slen + 1 >= tri->outspace){
1706 tri->outspace += TEREMAX(ALLOCOUT_CHUNK,slen+1);
1707 tmp = realloc(tri->out, tri->outspace * sizeof(uint8_t) );
1708 if(tmp){ tri->out = tmp; }
1711 memcpy(tri->out + tri->outused, src, slen+1); /* copy the terminator */
1712 tri->outused += slen; /* do not count the terminator in the length */
1720 \param tri pointer to a TR_INFO structure
1726 int trinfo_load_textrec(TR_INFO *tri, const TCHUNK_SPECS *tsp, double escapement, int flags){
1743 if(!tri)return(1);
1746 fti = tri->fti;
1747 tpi = tri->tpi;
1748 bri = tri->bri;
1755 if(!tri->dirty){
1756 tri->x = tsp->x;
1757 tri->y = tsp->y;
1758 tri->esc = escapement;
1759 tri->dirty = 1;
1762 if(tri->esc != escapement)return(-1);
1776 x = tpi->chunks[current].x - tri->x; /* convert to internal orientation */
1777 y = tpi->chunks[current].y - tri->y;
1796 status = TR_getadvance(fti, fsp, *tptr, (tri->use_kern ? prev: 0), tri->load_flags, tri->kern_mode, &ymin, &ymax);
1826 if(tri->load_flags & FT_LOAD_NO_SCALE) xe *= fixscale;
1843 if(tri->load_flags & FT_LOAD_NO_SCALE){
1914 \param tri pointer to a TR_INFO struct which will be analyzed. Result is stored in its "out" buffer.
1916 void TR_layout_2_svg(TR_INFO *tri){
1917 double x = tri->x;
1918 double y = tri->y;
1924 FT_INFO *fti=tri->fti; /* Font info storage */
1925 TP_INFO *tpi=tri->tpi; /* Text Info/Position Info storage */
1926 BR_INFO *bri=tri->bri; /* bounding Rectangle Info storage */
1927 CX_INFO *cxi=tri->cxi; /* Complexes deduced for this text */
1956 esc = tri->esc;
1969 TRPRINT(tri, "<rect\n");
1970 TRPRINT(tri, "style=\"color:#0000FF;color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:none;stroke:#000000;stroke-width:0.8;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero\"\n");
1972 TRPRINT(tri, obuf);
1974 TRPRINT(tri, obuf);
1976 TRPRINT(tri, obuf);
1977 TRPRINT(tri, stransform);
1978 TRPRINT(tri, "/>\n");
1984 TRPRINT(tri, "<rect\n");
1985 TRPRINT(tri, "style=\"color:#000000;color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:none;stroke:#00FF00;stroke-width:0.3;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero\"\n");
1987 TRPRINT(tri, obuf);
1989 TRPRINT(tri, obuf);
1991 TRPRINT(tri, obuf);
1992 TRPRINT(tri, stransform);
1993 TRPRINT(tri, "/>\n");
1997 TRPRINT(tri, obuf);
1999 TRPRINT(tri, obuf);
2000 TRPRINT(tri, stransform);
2001 TRPRINT(tri, "style=\"fill:#FF0000;");
2003 TRPRINT(tri, obuf);
2005 TRPRINT(tri, obuf);
2006 TRPRINT(tri, "font-variant:normal;");
2008 TRPRINT(tri, obuf);
2010 TRPRINT(tri, obuf);
2012 TRPRINT(tri, obuf);
2015 TRPRINT(tri, obuf);
2017 TRPRINT(tri, obuf);
2025 if(tri->usebk){
2026 esc = tri->esc;
2031 TRPRINT(tri, "<g>\n"); /* group backgrounds for each <text> object in the SVG */
2036 if(tri->usebk == BKCLR_LINE){
2037 TRPRINT(tri, "<rect\n");
2038 sprintf(obuf,"style=\"color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:#%2.2X%2.2X%2.2X;;stroke:none;;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero\"\n",tri->bkcolor.Red,tri->bkcolor.Green,tri->bkcolor.Blue);
2039 TRPRINT(tri, obuf);
2041 TRPRINT(tri, obuf);
2043 TRPRINT(tri, obuf);
2045 TRPRINT(tri, obuf);
2046 TRPRINT(tri, stransform);
2047 TRPRINT(tri, "/>\n");
2055 if(tri->usebk == BKCLR_ALL){
2056 TRPRINT(tri, "<rect\n");
2057 sprintf(obuf,"style=\"color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:#%2.2X%2.2X%2.2X;;stroke:none;;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero\"\n",tri->bkcolor.Red,tri->bkcolor.Green,tri->bkcolor.Blue);
2058 TRPRINT(tri, obuf);
2060 TRPRINT(tri, obuf);
2062 TRPRINT(tri, obuf);
2064 TRPRINT(tri, obuf);
2065 TRPRINT(tri, stransform);
2066 TRPRINT(tri, "/>\n");
2069 if(tri->usebk == BKCLR_FRAG){
2072 TRPRINT(tri, "<rect\n");
2073 sprintf(obuf,"style=\"color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:#%2.2X%2.2X%2.2X;;stroke:none;;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero\"\n",tri->bkcolor.Red,tri->bkcolor.Green,tri->bkcolor.Blue);
2074 TRPRINT(tri, obuf);
2076 TRPRINT(tri, obuf);
2078 TRPRINT(tri, obuf);
2080 TRPRINT(tri, obuf);
2081 TRPRINT(tri, stransform);
2082 TRPRINT(tri, "/>\n");
2086 TRPRINT(tri, "</g>\n"); /* end of grouping for backgrounds for each <text> object in the SVG */
2094 esc = tri->esc;
2102 TRPRINT(tri, obuf);
2135 TRPRINT(tri, "<text\n");
2136 TRPRINT(tri, "xml:space=\"preserve\"\n");
2137 TRPRINT(tri, "style=\"");
2139 TRPRINT(tri, obuf);
2141 TRPRINT(tri, obuf);
2142 TRPRINT(tri, "font-variant:normal;");
2144 TRPRINT(tri, obuf);
2146 TRPRINT(tri, obuf);
2150 TRPRINT(tri, obuf);
2151 TRPRINT(tri, "letter-spacing:0px;");
2152 TRPRINT(tri, "word-spacing:0px;");
2153 TRPRINT(tri, "fill:#000000;");
2154 TRPRINT(tri, "fill-opacity:1;");
2155 TRPRINT(tri, "stroke:none;");
2158 TRPRINT(tri, obuf);
2175 TRPRINT(tri, obuf);
2176 TRPRINT(tri, "\"\n"); /* End of style specification */
2178 TRPRINT(tri, obuf);
2181 TRPRINT(tri, obuf);
2185 TRPRINT(tri, obuf);
2187 TRPRINT(tri, "<tspan\n");
2196 TRPRINT(tri, obuf);
2198 TRPRINT(tri, obuf);
2200 TRPRINT(tri, obuf);
2202 TRPRINT(tri, obuf);
2228 TRPRINT(tri,obuf);
2230 TRPRINT(tri, "font-variant:normal;");
2232 TRPRINT(tri, obuf);
2234 TRPRINT(tri, obuf);
2237 TRPRINT(tri, obuf);
2238 TRPRINT(tri, "\n>");
2239 TRPRINT(tri, (char *) tsp->string);
2240 TRPRINT(tri, "</tspan>");
2243 TRPRINT(tri,"</tspan></text>\n");
2263 \param tri pointer to the TR_INFO structure holding the data, which will also hold the results.
2265 int TR_layout_analyze(TR_INFO *tri){
2291 if(!tri)return(-1);
2292 if(!tri->cxi)return(-2);
2293 if(!tri->tpi)return(-3);
2294 if(!tri->bri)return(-4);
2295 if(!tri->fti)return(-5);
2296 tpi=tri->tpi;
2297 cxi=tri->cxi;
2298 bri=tri->bri;
2299 fti=tri->fti;
2320 if(tspi->ldir == LDIR_RL){ TR_rt_pad_set(&rt_pad_i,tri->qe, tri->qe, tri->qe + 2.0 * spcadv, 0.0); }
2321 else { TR_rt_pad_set(&rt_pad_i,tri->qe, tri->qe, 0.0, tri->qe + 2.0 * spcadv); }
2332 TR_rt_pad_set(&rt_pad_j,tri->qe, tri->qe, spcadv, spcadv);
2357 TR_rt_pad_set(&rt_pad_i, tri->qe, tri->qe,
2358 tri->qe + 2.0 * spcadv, tri->qe + 2.0 * spcadv);
2384 if(tspi->ldir == LDIR_RL){ TR_rt_pad_set(&rt_pad_i,tri->qe, tri->qe, tri->qe + 2.0 * spcadv, 0.0); }
2385 else { TR_rt_pad_set(&rt_pad_i,tri->qe, tri->qe, 0.0, tri->qe + 2.0 * spcadv); }
2387 TR_rt_pad_set(&rt_pad_j,tri->qe, tri->qe, spcadv, spcadv);
2487 if(fabs(tspj->xkern) <= 2.0*tri->qe)tspj->xkern = 0.0;
2488 if(fabs(tspj->ykern) <= 2.0*tri->qe)tspj->ykern = 0.0;
2542 type = brinfo_pp_alignment(bri, cxi->cx[i].rt_cidx, cxi->cx[j].rt_cidx, 3*tri->qe, type);
2552 if(TR_check_set_vadvance(tri,j,i)){ /* check for compatibility with vadvance if set, set it if it isn't. */
2572 cxinfo_dump(tri);
2621 void init_as_svg(TR_INFO *tri){
2622 TRPRINT(tri,"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
2623 TRPRINT(tri,"<!-- Created with Inkscape (http://www.inkscape.org/) -->\n");
2624 TRPRINT(tri,"\n");
2625 TRPRINT(tri,"<svg\n");
2626 TRPRINT(tri," xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n");
2627 TRPRINT(tri," xmlns:cc=\"http://creativecommons.org/ns#\"\n");
2628 TRPRINT(tri," xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n");
2629 TRPRINT(tri," xmlns:svg=\"http://www.w3.org/2000/svg\"\n");
2630 TRPRINT(tri," xmlns=\"http://www.w3.org/2000/svg\"\n");
2631 TRPRINT(tri," xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\n");
2632 TRPRINT(tri," xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n");
2633 TRPRINT(tri," width=\"900\"\n");
2634 TRPRINT(tri," height=\"675\"\n");
2635 TRPRINT(tri," id=\"svg4122\"\n");
2636 TRPRINT(tri," version=\"1.1\"\n");
2637 TRPRINT(tri," inkscape:version=\"0.48+devel r11679 custom\"\n");
2638 TRPRINT(tri," sodipodi:docname=\"simplest_text.svg\">\n");
2639 TRPRINT(tri," <defs\n");
2640 TRPRINT(tri," id=\"defs4124\" />\n");
2641 TRPRINT(tri," <sodipodi:namedview\n");
2642 TRPRINT(tri," id=\"base\"\n");
2643 TRPRINT(tri," pagecolor=\"#ffffff\"\n");
2644 TRPRINT(tri," bordercolor=\"#666666\"\n");
2645 TRPRINT(tri," borderopacity=\"1.0\"\n");
2646 TRPRINT(tri," inkscape:pageopacity=\"0.0\"\n");
2647 TRPRINT(tri," inkscape:pageshadow=\"2\"\n");
2648 TRPRINT(tri," inkscape:zoom=\"0.98994949\"\n");
2649 TRPRINT(tri," inkscape:cx=\"309.88761\"\n");
2650 TRPRINT(tri," inkscape:cy=\"482.63995\"\n");
2651 TRPRINT(tri," inkscape:document-units=\"px\"\n");
2652 TRPRINT(tri," inkscape:current-layer=\"layer1\"\n");
2653 TRPRINT(tri," showgrid=\"false\"\n");
2654 TRPRINT(tri," width=\"0px\"\n");
2655 TRPRINT(tri," height=\"0px\"\n");
2656 TRPRINT(tri," fit-margin-top=\"0\"\n");
2657 TRPRINT(tri," fit-margin-left=\"0\"\n");
2658 TRPRINT(tri," fit-margin-right=\"0\"\n");
2659 TRPRINT(tri," fit-margin-bottom=\"0\"\n");
2660 TRPRINT(tri," units=\"in\"\n");
2661 TRPRINT(tri," inkscape:window-width=\"1200\"\n");
2662 TRPRINT(tri," inkscape:window-height=\"675\"\n");
2663 TRPRINT(tri," inkscape:window-x=\"26\"\n");
2664 TRPRINT(tri," inkscape:window-y=\"51\"\n");
2665 TRPRINT(tri," inkscape:window-maximized=\"0\" />\n");
2666 TRPRINT(tri," <metadata\n");
2667 TRPRINT(tri," id=\"metadata4127\">\n");
2668 TRPRINT(tri," <rdf:RDF>\n");
2669 TRPRINT(tri," <cc:Work\n");
2670 TRPRINT(tri," rdf:about=\"\">\n");
2671 TRPRINT(tri," <dc:format>image/svg+xml</dc:format>\n");
2672 TRPRINT(tri," <dc:type\n");
2673 TRPRINT(tri," rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" />\n");
2674 TRPRINT(tri," <dc:title></dc:title>\n");
2675 TRPRINT(tri," </cc:Work>\n");
2676 TRPRINT(tri," </rdf:RDF>\n");
2677 TRPRINT(tri," </metadata>\n");
2678 TRPRINT(tri," <g\n");
2679 TRPRINT(tri," inkscape:label=\"Layer 1\"\n");
2680 TRPRINT(tri," inkscape:groupmode=\"layer\"\n");
2681 TRPRINT(tri," id=\"layer1\"\n");
2682 TRPRINT(tri," transform=\"translate(0,0)\">\n");
2683 TRPRINT(tri,"\n");
2687 void flush_as_svg(TR_INFO *tri, FILE *fp){
2688 fwrite(tri->out,tri->outused,1,fp);
2691 FILE *close_as_svg(TR_INFO *tri, FILE *fp){
2692 TRPRINT(tri, " </g>\n");
2693 TRPRINT(tri, "</svg>\n");
2694 flush_as_svg(tri,fp);
2712 TR_INFO *tri=NULL;
2756 tri = trinfo_init(tri); /* If it loops the trinfo_clear at the end will reset tri to the proper state, do NOT call trinfo_init twice! */
2789 if(!tri){
2793 (void) trinfo_load_ft_opts(tri, 1,
2798 init_as_svg(tri);
2817 if((tsp.fi_idx = ftinfo_load_fontname(tri->fti, fontspec)) < 0 )boom("Font load failed",lineno);
2838 status = trinfo_load_textrec(tri, &tsp, escapement,flags);
2840 TR_layout_analyze(tri);
2841 TR_layout_2_svg(tri);
2842 flush_as_svg(tri, fpo);
2843 tri = trinfo_clear(tri);
2844 if(trinfo_load_textrec(tri, &tsp, escapement,flags)){ boom("Text load failed",lineno); }
2872 (void) trinfo_load_qe(tri,fact);
2888 (void) trinfo_load_bk(tri,bkmode,bkcolor);
2922 TR_layout_analyze(tri);
2923 TR_layout_2_svg(tri);
2924 flush_as_svg(tri, fpo);
2925 tri = trinfo_clear(tri);
2928 TR_layout_analyze(tri);
2929 TR_layout_2_svg(tri);
2930 flush_as_svg(tri, fpo);
2931 tri = trinfo_clear(tri);
2943 fpo=close_as_svg(tri, fpo);
2948 tri = trinfo_clear(tri);
2954 tri = trinfo_release(tri);