diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2014-10-05 10:21:45 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2014-10-05 10:21:45 +0000 |
| commit | 92b3e813281005a82b50aed4e168aa938575920e (patch) | |
| tree | 61c69cd4eb68ec6620bb6ff27c975c797a3da569 /src/libnrtype | |
| parent | More direct way of finding font-family in SPText::description. (diff) | |
| download | inkscape-92b3e813281005a82b50aed4e168aa938575920e.tar.gz inkscape-92b3e813281005a82b50aed4e168aa938575920e.zip | |
Remove unused functions.
(bzr r13341.1.244)
Diffstat (limited to 'src/libnrtype')
| -rw-r--r-- | src/libnrtype/FontInstance.cpp | 149 | ||||
| -rw-r--r-- | src/libnrtype/font-instance.h | 6 |
2 files changed, 0 insertions, 155 deletions
diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index ce4c99ef7..a5572c517 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -239,155 +239,6 @@ void font_instance::Unref(void) } } -unsigned int font_instance::Name(gchar *str, unsigned int size) -{ - return Attribute("name", str, size); -} - -unsigned int font_instance::Family(gchar *str, unsigned int size) -{ - return Attribute("family", str, size); -} - -unsigned int font_instance::PSName(gchar *str, unsigned int size) -{ - return Attribute("psname", str, size); -} - -unsigned int font_instance::Attribute(const gchar *key, gchar *str, unsigned int size) -{ - if ( descr == NULL ) { - if ( size > 0 ) { - str[0]=0; - } - return 0; - } - char* res=NULL; - bool free_res=false; - - if ( strcmp(key,"name") == 0 ) { - PangoFontDescription* td=pango_font_description_copy(descr); - pango_font_description_unset_fields (td, PANGO_FONT_MASK_SIZE); - res=pango_font_description_to_string (td); - pango_font_description_free(td); - free_res=true; - } else if ( strcmp(key,"psname") == 0 ) { -#ifndef USE_PANGO_WIN32 - res = (char *) FT_Get_Postscript_Name (theFace); // that's the main method, seems to always work -#endif - free_res=false; - if (res == NULL) { // a very limited workaround, only bold, italic, and oblique will work - PangoStyle style=pango_font_description_get_style(descr); - bool i = (style == PANGO_STYLE_ITALIC); - bool o = (style == PANGO_STYLE_OBLIQUE); - PangoWeight weight=pango_font_description_get_weight(descr); - bool b = (weight >= PANGO_WEIGHT_BOLD); - - res = g_strdup_printf ("%s%s%s%s", - sp_font_description_get_family(descr), - (b || i || o) ? "-" : "", - (b) ? "Bold" : "", - (i) ? "Italic" : ((o) ? "Oblique" : "") ); - free_res = true; - } - } else if ( strcmp(key,"family") == 0 ) { - res=(char*)sp_font_description_get_family(descr); - free_res=false; - } else if ( strcmp(key,"style") == 0 ) { - PangoStyle v=pango_font_description_get_style(descr); - if ( v == PANGO_STYLE_ITALIC ) { - res=(char*)"italic"; - } else if ( v == PANGO_STYLE_OBLIQUE ) { - res=(char*)"oblique"; - } else { - res=(char*)"normal"; - } - free_res=false; - } else if ( strcmp(key,"weight") == 0 ) { - PangoWeight v=pango_font_description_get_weight(descr); - if ( v <= PANGO_WEIGHT_THIN ) { - res=(char*)"100"; - } else if ( v <= PANGO_WEIGHT_ULTRALIGHT ) { - res=(char*)"200"; - } else if ( v <= PANGO_WEIGHT_LIGHT ) { - res=(char*)"300"; -#if PANGO_VERSION_CHECK(1,36,6) - } else if ( v <= PANGO_WEIGHT_SEMILIGHT ) { - res=(char*)"350"; -#endif - } else if ( v <= PANGO_WEIGHT_BOOK ) { - res=(char*)"380"; - } else if ( v <= PANGO_WEIGHT_NORMAL ) { - res=(char*)"normal"; - } else if ( v <= PANGO_WEIGHT_MEDIUM ) { - res=(char*)"500"; - } else if ( v <= PANGO_WEIGHT_SEMIBOLD ) { - res=(char*)"600"; - } else if ( v <= PANGO_WEIGHT_BOLD ) { - res=(char*)"bold"; - } else if ( v <= PANGO_WEIGHT_ULTRABOLD ) { - res=(char*)"800"; - } else { // HEAVY NB: Pango defines ULTRAHEAVY = 1000 but not CSS2 - res=(char*)"900"; - } - free_res=false; - } else if ( strcmp(key,"stretch") == 0 ) { - PangoStretch v=pango_font_description_get_stretch(descr); - if ( v <= PANGO_STRETCH_EXTRA_CONDENSED ) { - res=(char*)"extra-condensed"; - } else if ( v <= PANGO_STRETCH_CONDENSED ) { - res=(char*)"condensed"; - } else if ( v <= PANGO_STRETCH_SEMI_CONDENSED ) { - res=(char*)"semi-condensed"; - } else if ( v <= PANGO_STRETCH_NORMAL ) { - res=(char*)"normal"; - } else if ( v <= PANGO_STRETCH_SEMI_EXPANDED ) { - res=(char*)"semi-expanded"; - } else if ( v <= PANGO_STRETCH_EXPANDED ) { - res=(char*)"expanded"; - } else { - res=(char*)"extra-expanded"; - } - free_res=false; - } else if ( strcmp(key,"variant") == 0 ) { - PangoVariant v=pango_font_description_get_variant(descr); - if ( v == PANGO_VARIANT_SMALL_CAPS ) { - res=(char*)"small-caps"; - } else { - res=(char*)"normal"; - } - free_res=false; - } else { - res = NULL; - free_res=false; - } - if ( res == NULL ) { - if ( size > 0 ) { - str[0] = 0; - } - return 0; - } - - if (res) { - unsigned int len=strlen(res); - unsigned int rlen=(size-1<len)?size-1:len; - if ( str ) { - if ( rlen > 0 ) { - memcpy(str, res, rlen); - } - if ( size > 0 ) { - str[rlen] = 0; - } - } - if (free_res) { - g_free(res); - res = 0; - } - return len; - } - return 0; -} - void font_instance::InitTheFace() { if (theFace == NULL && pFont != NULL) { diff --git a/src/libnrtype/font-instance.h b/src/libnrtype/font-instance.h index 75106617b..2c7d1ce46 100644 --- a/src/libnrtype/font-instance.h +++ b/src/libnrtype/font-instance.h @@ -65,12 +65,6 @@ public: // for generating slanted cursors for oblique fonts Geom::OptRect BBox(int glyph_id); - // attribute queries - unsigned Name(gchar *str, unsigned size); - unsigned PSName(gchar *str, unsigned size); - unsigned Family(gchar *str, unsigned size); - unsigned Attribute(gchar const *key, gchar *str, unsigned size); - private: void FreeTheFace(); |
