Commit Graph

64 Commits

Author SHA1 Message Date
abdulleh Ghujeh f6caca1d70 Efl Canvas Text : Modify Style Property
Summary:
This patch defines the way style property will work at canvas_text object

1- Changing canvas_text style property using Font/Format/Style interfaces or with efl_canvas_text style property are the same.
     Example:

```
efl_text_font_set(tb, "Arial", 30);
//is same as
efl_canvas_text_style_set(tb, "font=Arial font_size=30");

//which means calling
char * font;
int size;
int font_size;
efl_text_font_get(tb, &font, &size);
// calling this after any of the top two functions will return same result
```

2- style_get_property
     Will return string that contains full details about all the current applied style at canvas_text  level.

3- style_set_property
     Will only override passed styles and leave everything else as it is

```
efl_canvas_text_style_set(tb, "font=Arial");  // overrider font name to Arial and leave everthing else
efl_canvas_text_style_set(tb, "font_size=30");  // overrider font size to 30 and leave everthing else (font name will stay arial)
```

Reviewers: ali.alzyod, woohyun, tasn, segfaultxavi, bu5hm4n, zmike

Reviewed By: woohyun

Subscribers: zmike, bu5hm4n, segfaultxavi, a.srour, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10607
2019-11-28 13:14:15 +09:00
Mike Blumenkrantz 1d62c95a2a evas/font: simplify handling strings when constructing font names
no need to strcpy here when we can just pass the length to stringshare directly

CID 1382854

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10441
2019-10-30 08:49:05 -07:00
Vincent Torri 24e4881efb Evas: remove Evil.h when not needed and use evil_private when needed
Test Plan: compilation

Reviewers: zmike, raster, cedric

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8921
2019-05-20 08:46:02 -04:00
Christopher Michael 750b21830f evas-font-dir: Minor formatting fixes
NB: No functional changes
2019-04-01 09:05:57 -04:00
Daniel Hirt 3db6b94ec8 Evas font: simplify fallback parsing step
@fix
2018-07-02 12:49:18 +03:00
Youngbok Shin a882235fce Evas font: add comparison for fallbacks in evas_font_desc_cmp()
Summary:
fallbacks string also has to be compared to load proper fdesc.
If a font which does not have fallback fonts is loaded,
fallback fonts can't be appended to the same font.
@fix

Reviewers: tasn, woohyun, herdsman, zmike, devilhorns

Reviewed By: herdsman

Subscribers: #committers, zmike, raster, Blackmole, z-wony, cedric, jpeg

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D3707
2018-07-02 11:08:30 +03:00
Youngbok Shin baf3a2092a Evas font: fix inifinite loop problem for fallback fonts
Summary:
When multiple fallback fonts was passed to evas_font_load(),
the while loop could run forever. I think it is never tested.
@fix

Test Plan:
Set the following textblock style and set it to a textblock object.
"font=Sans font_fallbacks=Ubuntu,Inconsolata,BlahBlah font_size=..."

Run and see application is in stuck.

Reviewers: tasn, woohyun, herdsman, devilhorns

Subscribers: #committers, zmike, raster, Blackmole, z-wony, cedric, jpeg

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D3703
2018-07-02 11:08:30 +03:00
Vincent Torri 4ae6eeb2cf efl: remove _MSC_VER (Visual Studio macro) usage in source code 2018-01-04 12:59:47 -08:00
subhransu mohanty b038d7df25 Remove evas internal dependency from the evas_font module
Summary:
dev branch : devs/subhransu/font

The Final goal is to move the evas_font module to ector so that both ector and evas can reuse the code.
make the api simple so that sam eapi can be used by evas_textblock and ector text.

This is the 1st stage to achive that gola, first remove the evas internal dependancy as much as possible before moving to ector library.

Reviewers: jpeg, raster, herdsman, cedric, id213sin

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5419
2017-11-07 11:34:53 +09:00
Youngbok Shin 26b58098bc evas font: check returned value of FcPatternGet function
Summary:
Evas should add font when only FcPatternGet function gives matched result.
@fix

Test Plan: N/A

Reviewers: raster, cedric, herdsman, jpeg

Differential Revision: https://phab.enlightenment.org/D5236
2017-09-29 15:16:21 +09:00
Youngbok Shin 1750410650 evas: Add scale feature for embedded bitmap fonts.
Summary:
When evas selects a strike of embedded bitmap font,
calculate ratio and use it for scaling embedded bitmap.
@feature

Reviewers: jpeg, tasn, woohyun, raster, herdsman

Reviewed By: raster

Subscribers: charlesmilette, Francesco149, cedric

Differential Revision: https://phab.enlightenment.org/D2713
2017-09-26 11:31:31 +09:00
Vincent Torri 0cdd501246 EFL For WIN32: Replace HAVE_EVIL define with _WIN32 2017-09-22 05:06:10 -05:00
Youngbok Shin 5e5e408e58 evas font: append global font path when Evas initializes Fontconfig
Summary:
If there are appended font pathes before initializing Fontconfig,
Evas must care the font pathes after initializing Fontconfig.
@fix

Test Plan:
1. Call evas_font_path_global_append() with a private font path
   before adding any Evas Object.
2. Add a Evas Textblock object which uses a font from the private font path.
3. See the font is not loaded properly without the patch.

Reviewers: raster, cedric, herdsman, jpeg, woohyun

Differential Revision: https://phab.enlightenment.org/D4867
2017-07-11 15:46:04 +09:00
Carsten Haitzler b310e5892c evas - font dir fonts.alias - limit alias parse length
a rouge fonts.alias file in a font dir/path could contain long strings
that buffers dont have space for, so limit length of string.

@fix
2017-06-08 14:48:08 +09:00
Jean-Philippe Andre a1abc129ec evas: Remove font_hinting from EO
We only need it in elm_config.
This removes the type Evas_Font_Hinting_Flags from EO,
as well as the functions font_hinting_set/get and
font_hinting_can_hint.

Ref T5312
2017-05-15 17:12:15 +09:00
Cedric BAIL 55e1b3f205 evas: remove engine.data.output.
This is the first step toward handling multi output. This patch
remove engine.data.output from Evas structure and use an Eina_List
for it instead. It also start moving code around to fetch an output
or an engine context (which are the same at the moment, but will be
split in a later patch).
2017-04-24 15:10:48 -07:00
Youngbok Shin 65be73c58f evas font: revise evas_font_init/reinit functions
Summary:
The static flag in evas_font_init() was not useful.
It could be replaced by checking address of "fc_config".
FcInitReinitialize() function was not necessary to reload
configure and font files in Evas. It would be meaningful
when only Evas use Fontconfig's function without own "fc_config".
To reload "fc_config", calling FcInitLoadConfigAndFonts() is enough.
And there is no need to load "fc_config" from evas_font_reinit()
when "fc_config" is not prepared.

Test Plan: N/A

Reviewers: herdsman, raster, tasn, cedric, woohyun

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4612
2017-01-21 19:00:46 +09:00
Tom Hacohen e65aae994e Eo: Finish the renaming of Eo to the EFL.
This renames all the rest of the API to the EFL namespace except for
Eo_Event that will follow soon.

Obviously breaks both API and ABI.
2016-08-15 15:07:42 +01:00
Jean-Philippe Andre d4b9328dcd evas: Fix double stringshare_del
A stringshare for font "style" was not properly duplicated,
resulting in lots of invalid stringshare pointers.

Ping @id213sin (commit 2ce33e73a7).
2016-06-28 19:21:46 +09:00
Youngbok Shin 2ce33e73a7 evas: add pattern "style" when evas query fonts via fontconfig
Summary:
Some fonts can have weird style and weight value.
If a font has a style name as "medium" and a weight value as "semi-bold",
Evas can't load the font using "font=Somefont:style=Medium".
It only can be load with "font=Somefont:style=SemiBold" or
"font=Somefont:weight=SemiBold".
On the other hand, it could be loaded when I tested the following commands.
fc-match -s ":family=Somefont:style=Medium" or
fc-match -s ":family=Somefont:weight=SemiBold"

Evas also should load font based on font's style name.
@fix

Test Plan: N/A

Reviewers: tasn, herdsman, cedric, woohyun, raster

Reviewed By: raster

Subscribers: Blackmole, z-wony, jpeg

Differential Revision: https://phab.enlightenment.org/D4108
2016-06-28 13:32:49 +09:00
Jean-Philippe Andre 7bf8da2baa evas: Rename Evas.Object to Efl.Canvas.Object
One step closer to make the EO inheritance tree look like
it's all Efl.
2016-06-21 14:35:19 +09:00
Mike Blumenkrantz 6f4f0100d2 evas: add a few null checks for e->engine.data.output
this can be null if engine info has not yet been set or if engine info
has been unset, leading to engine crashes. instead of adding null checks in
every engine, better to add the checks to the originating functions

someone with time to kill should go through all the EAPI functions and
add more checks
2016-05-05 10:49:30 -04:00
Youngbok Shin d9b93542cf Evas font: allow ":fallbacks" keyword when Evas parses font keyword
Summary:
Developers could use fallback fonts using only font_fallbacks keyword.
The keyword is only allowed for Evas Textblock. It has to be common
feature for other text type objects.
Applying this patch, Text and Textgrid can add fallback fonts.
@feature

Test Plan:
Set font like the following example to Textblock, Text, Textgrid.
Sans:fallbacks=Inconsolata

Reviewers: tasn, herdsman, woohyun

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3704
2016-02-17 09:23:06 +00:00
Youngbok Shin b4f254e1a3 Evas font: Use proper enum value for extrabold
Summary:
ULTRABOLD is identical to EXTRABOLD in freetype.
But, "extrabold" word is added for FC_WEIGHT_EXTRABOLD.
So, it has to be changed to use EXTRABOLD instead of
ULTRABOLD. It was mistake in my previous commit.
@fix

Test Plan: N/A

Reviewers: tasn, herdsman, woohyun

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3673
2016-02-11 10:17:46 +00:00
Youngbok Shin d15d91e0da Evas Text/Textblock: Use locale for lang as default.
Summary:
The configuration files for Fontconfig can describe
how font list is made according to language information.
EFL also set the language for each Evas textblock styles
and used for loading font list.

But, this is inconvenient to use if we want to apply language
for loading font list according to system-wide locale information.
This patch will apply locale information for font list if there is
no specific language in description.

And it also add [lang=auto] for Evas Textblock.
auto - It loads locale for language.
none - It disables language.

@feature

Test Plan: N/A

Reviewers: woohyun, herdsman, tasn

Subscribers: jpeg, cedric

Differential Revision: https://phab.enlightenment.org/D3344
2016-02-02 10:22:09 +00:00
Minwoo, Lee 3f5066278e evas: fix a NULL dereference issue
Summary:
If evas engine init failed, it can make crash.
For example
If opengl init failed, then ee->prop.window is 0
ecore_evas_gl_x11_options_new_internal
{
   if (!ee->prop.window)
     {
        ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
        ecore_evas_free(ee);
        return NULL;
     }
}

ecore_evas_free calls evas_fonts_zero_pressure
and this time evas->engine.func is NULL so it makes crash.

Reviewers: cedric

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3542

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-01-06 13:36:40 -08:00
Youngbok Shin 917fdbd597 evas: fix a NULL dereference issue in font.
Summary:
eina_list_remove returns Eina_List pointer.
It could be NULL if the last list item is removed.
And the returned Eina_List pointer could be different from the given list.
So, calling free for fdir->data after fdir's address is changed is dangerous.
@fix

Test Plan: Run expedite or test app with evas_font_path_append() API.

Reviewers: stefan_schmidt, jpeg

Reviewed By: jpeg

Subscribers: stefan, jiin.moon, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3392

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-01 15:03:51 -08:00
Stefan Schmidt 54abe37c44 evas_font_dir: do not passed free'd memory to eina_list_remove()
Free the actual memory after we removed it from the list.
2015-11-30 17:36:24 +01:00
Youngbok Shin 507baf4891 evas: Add ExtraLight, ExtraBold for font weight.
Summary:
Evas supports UltraLight, UltraBold as font weight.
These terms have same weight value as ExtraLight, ExtraBold.
Some applications, for example, fontforge, use ExtraLight, ExtraBold terms for these weight values.
So, it would be better to support these terms, too.
@feature

Test Plan: None

Reviewers: tasn, woohyun, herdsman

Reviewed By: herdsman

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3126
2015-11-26 10:16:14 +02:00
Youngbok Shin 6616d11619 evas/font: Add evas_font_reinit API.
Summary:
Reinitialize FontConfig. If FontConfig has to be reinitialized
according to changes of system enviroments(ex. Changing font config files), it will be useful.

Reviewers: woohyun, seoz, tasn, cedric, raster

Reviewed By: raster

Subscribers: raster, herdsman, cedric

Differential Revision: https://phab.enlightenment.org/D1962
2015-03-19 18:01:42 +09:00
Carsten Haitzler 7c5f92d702 evas - render - have lock point to allow for async obj walk + update add
this adds a lock for when walking all the objects to generate render
commands for an async render. this allows even the object tree walk
plus update area caluclation to be moved off into async if every oject
that can change canvas state actually does so correctly. this change
adds all those lock block calls to synchronise with an async object
tree walk.
2015-02-12 11:06:40 +09:00
Carsten Haitzler 24ad46488f evas font dir - remove unused pointer
fixes CID 1039480
2014-08-25 13:05:21 +09:00
Tom Hacohen 7f3a44894b Evas canvas eolian: Fix namespace and class name for the evas canvas. 2014-06-30 17:47:06 +01:00
Tom Hacohen 1d52065438 Evas textblock: Fix issue with edje fonts not being used.
The issue was within the fontconfig fallback mechanism and our cache. We
used to just use the fontconfig fallback list, instead of also using the
correct edje font.

This can probably be improved a bit by not caching the fontconfig set,
but cache a list of the filenames instead. This is more generic and will
improve cache as well.

Fixes T1331

@fix
2014-06-13 15:29:59 +01:00
Tom Hacohen 0fc3279db9 Efl: Update code to use the new class names generated by eolian. 2014-06-03 11:28:01 +01:00
Jaehyun Cho eee9607a4b evas_font_dir: Prevent the use after free
Summary: Pointer fd is used after being deallocated.

Reviewers: Hermet

Reviewed By: Hermet

CC: seoz, cedric

Differential Revision: https://phab.enlightenment.org/D906
2014-05-28 11:24:34 +09:00
Cedric BAIL d3bc06ae33 evas: simplify path logic and make backend code more robust.
Fix CID 1039665.
2014-03-13 10:57:38 +09:00
Daniel Zaoui 103e89a04a Eolian: Integration of Evas 2014-03-12 10:57:28 +02:00
Youngbok Shin cb5026137b evas/font: Added evas_font_path_global_* APIs.
Summary:
These APIs will be used for adding font paths for the application.
The existing APIs for font path, such as evas_font_path_append,
are used for adding font paths to the given evas.
But, these APIs will affect to every evas in the process.

Reviewers: tasn, woohyun, Hermet, seoz

CC: cedric, herdsman

Differential Revision: https://phab.enlightenment.org/D621

@feature
2014-03-11 11:21:56 +00:00
Tom Hacohen cb9a06f550 Evas font: Don't add canvas specific path to the global fontconfig path list.
This will come back when D621 gets in (which implements it correctly).
2014-03-10 16:17:21 +00:00
Tom Hacohen dae9eacb14 Revert "Evas font: Change font fallback to not depend on fontconfig >= 2.11."
It seems that before 2.10, this was not stable, and was causing issues
to some people. I guess we'll have to bring the dependency back, at
least until we can find a better solution.

This reverts commit ec41f67be4.

This fixes T1006.
2014-02-21 09:47:30 +00:00
Youngbok Shin 2bff3d1c2e evas - Added eina_stringshare_ref call for fallbacks, lang in font description.
Summary:
When the fdesc(Font Description) is duplicated,
ref of all of stringshare pointers should be increased.
But, in the evas_font_desc_dup API, we only increased ref for name string.
It can cause some of memory issues.

Reviewers: tasn, woohyun, seoz, Hermet

CC: cedric

Differential Revision: https://phab.enlightenment.org/D570
2014-02-19 10:44:34 +00:00
Tom Hacohen ec41f67be4 Evas font: Change font fallback to not depend on fontconfig >= 2.11.
Apparently, it was available for quite a while. It's just a case of confusing documentation
that made me think the minimum version is 2.11.
2014-02-05 13:54:41 +00:00
Tom Hacohen 17d028f944 Evas font: Added support for font fallback for eet/edje fonts.
This is a long awaited feature that has been requested years ago.
Fontconfig finally added the support needed to make it happen, so here
it is.

I added a fontconfig query to look for similar fonts in case we loaded a
font from eet/edje/file(no fontconfig). This now works quite well.

Still missing: if you load a bold/italic/whatever font directly (set the file)
without putting ":weight=bold" you will not get run-time emboldenment if
only non-bold fonts are found.

This unfortunately depends on very recent fontconfig version (#ifed out
when unavailable), so only people with fontconfig >= 2.11 will enjoy
this feature.
2014-02-04 10:44:11 +00:00
Tom Hacohen 1c44890491 Evas font: Renamed evas_load_fontconfig and added support for a base set.
Renamed it so it'll be more obvious that it's internal.
Added the parameter as the first step towards supporting edje font
fallback using fontconfig.
2014-02-04 10:44:11 +00:00
Carsten Haitzler ef2127c900 evas - fix tom's bold-killer from 2cb9db171e 2014-02-02 10:59:33 +09:00
Tom Hacohen 19cde8f194 Evas font: Added support for the freetype spacing tag.
This doesn't work nicely, as for some reason fontconfig doesn't work
nicely with ':spacing=mono' without a font name.
Doesn't work with fc-match either. It does work with fc-list, but that's
not what we'd like to use. It could be just an issue with my local
fontconfig configuration.

This fixes T865 although the problem is now with freetype.
2014-01-29 14:36:22 +00:00
Tom Hacohen 2cb9db171e Evas font: Added support for weight/width/slant font tags.
This let's you set those directly, instead of using the style tag.
2014-01-29 14:10:43 +00:00
Carsten Haitzler 98293fadb1 evas - font dir - remove from hash before free/del
this addresses CID 1039889 but was otherwise harmless
2013-12-11 19:49:36 +09:00
ChunEon Park bff48f92a3 evas - fix the memory corruption introduced by evas fonts_zero 2013-11-26 20:32:42 +09:00