View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0015629||Scribus||Scripter||public||2019-04-04 09:34||2019-06-04 20:55|
|Target Version||Fixed in Version||1.5.5.svn|
|Summary||0015629: Calling createCharStyle() with no arguments creates a style with a font size of 200 pt|
creates a style with a font size of 200 pt... which is not a sane size.
|Tags||No tags attached.|
... ok i see that there were a few more commit last night...
... i'll merge them and do my tests again...
the 200pt are still a problem... i've reduced the ticket to the part that is still relevant...
thanks jean for fixing the font selection! that part now works
||btw, a simpler and probably better solution for picking the font: use the default from the preferences > item tools > text.|
the other way round:
the scripter should create a copy of "Default Character Style" instead of creating new style from scratch. It should also get the default values from "Default Character Style", instead of making up values.
or keeping on creating the style from thin air, but at least get the default values from the default char style.
i will try to make a patch for it.
ok, got it:
in scribus/plugins/scriptplugin/cmdstyle.cpp, scribus_createcharstyle(...) do:
const auto defaultStyle = ScCore->primaryMainWindow()->doc->charStyles().getDefault();
double FontSize = defaultStyle->fontSize() / 10, ...
correctly filling all the default values, is left to the reader as an exercise : - )
this way, it should be possible to remove most of yesterday's patch about picking the right font style...
||i can write a patch for all attributes if you plan to apply it "as is"...|
>> the scripter should create a copy of "Default Character Style" instead of creating new style from scratch. It should also get the default values from "Default Character Style", instead of making up values.
While in theory I agree, changing too much current behavior may break lots of existing scripts. So I would restrict the behavior change to font size.
i don't think that people will notice the difference.
people who wanted any control on how the style is created, will add all the possible formatting.
the other people will probably not have changed the default style in a way that disrupts the creation of new styles based on the default style (instead of fixed value.. which should match a sane default).
in my eyes, it's way more important to have a consistent (and sane) behavior, rather than focus too much on keeping bad behavior around.
and such a change is not breaking existing documents, it just might require a change to scripts... but i don't think that many will be affected (if any!)
||I realized in fact yesterday that changing current behavior has another drawback: that will allow situations where a same script will produce different results on different workstations. I'm not sure we really want that.|
jean, where is the problem?
if somebody wants the same behavior everywhere, she has to set the default styles correctly or correctly define the new style.
relying on the defaults will give you the users defaults. i really don't see where the problem is.
of course, we need to be able to specify the parent style for a new style. i think i've created a ticket for that too!
p.s.: if you want a specific formatting you have to create a char style and build your other styles upon it. that sounds very sane to me.
||After discussion with Craig, it was in the end decided to change the behavior... which required some additional doc updates.|
|2019-04-04 09:34||ale||New Issue|
|2019-04-04 09:36||ale||Note Added: 0046062|
|2019-04-04 09:48||ale||Summary||Scripter: createCharStyle() with no arguments does not (always) create a valid font + font style && font size is 200pt => Scripter: createCharStyle() with no arguments the font size is 200pt|
|2019-04-04 09:48||ale||Description Updated||View Revisions|
|2019-04-04 09:48||ale||Note Added: 0046063|
|2019-04-04 09:50||ale||Note Added: 0046064|
|2019-04-04 11:39||ale||Note Added: 0046065|
|2019-04-04 13:45||ale||Note Added: 0046066|
|2019-04-04 13:53||ale||Note Added: 0046067|
|2019-04-04 13:55||ale||Note Edited: 0046066||View Revisions|
|2019-04-04 14:12||ale||Relationship added||related to 0015631|
|2019-04-04 19:13||jghali||Summary||Scripter: createCharStyle() with no arguments the font size is 200pt => Calling createCharStyle() with no arguments creates a style with a font size of 200 pt|
|2019-04-07 14:05||jghali||Note Added: 0046083|
|2019-04-08 12:47||ale||Note Added: 0046088|
|2019-04-13 12:21||jghali||Note Added: 0046127|
|2019-04-15 06:39||ale||Note Added: 0046128|
|2019-04-26 23:48||jghali||Assigned To||=> jghali|
|2019-04-26 23:48||jghali||Status||new => resolved|
|2019-04-26 23:48||jghali||Resolution||open => fixed|
|2019-04-26 23:48||jghali||Fixed in Version||=> 1.5.5.svn|
|2019-04-26 23:48||jghali||Note Added: 0046168|
|2019-04-27 09:58||ale||Note Added: 0046169|
|2019-06-04 20:55||cbradney||Status||resolved => closed|