I am working on a font dialog for epad and what i do and this is in python
is:

       tb_style = self.font_demo.textblock.style_get()

        font =
tb_style.split('text_class=entry_text')[1].split('font=')[1].split("'em=")[0]
        # font may or may not have style associated with it
        if ':style=' in font:
            font, style = font.split(':style=')
        else:
            style = None
        # If font name or styyle has spaces in it
        #   textblock.style_get() inserts '\' before space
        #   then the python string split function adds another space
        # To set the style with a font name that has spaces spaces need to
be removed
        font = font.replace('\\ ',' ')
        if style:
            style = style.replace('\\ ',' ')
        size =
tb_style.split('text_class=entry_text')[1].split('font_size=')[1].split('
')[0]
        self.theme_data = [font, style, float(size)]

But i am setting a user style for the entry and to revert back to the
default font I just remove all styles. I do want my font dialog to display
the theme font but i am unsure what to do about the font style unless it is
specified. SO i just select nothing for style in the font dialog.

It is also worth mentioning in the above code I do not use the default font
because the user can change things using elementary_config or the theme
itself may specify a different font for entry_text.

On Tue, May 2, 2017 at 4:50 PM, Daniel Hirt <hirt.da...@gmail.com> wrote:

> Hello,
>
> Off the top of my head: upon creating the elm_code widget, store the result
> of 'elm_code_widget_font_get' as your "default font". Then, reverting is
> just doing 'elm_code_widget_font_set' with the stored "default font".
>
> As a side note: I am not sure elm_code_widget utilizes the theme for fonts.
>
> -herdsman
>
> On Tue, May 2, 2017 at 7:43 PM, William L. Thomson Jr. <wlt...@o-sinc.com>
> wrote:
>
> > In working with Ecrire, there is a setting; standard in most editors,
> > to set a custom font. That works fine, for the most part. I am having
> > problems reverting back to the default font. Which is where I am stuck.
> > I have been looking all over and trying various things that do not work.
> >
> > It seems the font name is at least in the theme. Themes seem to set a
> > font. I am not sure if that font name can be fetched. Some font is being
> > used by default for text in any objects/widgets.
> >
> > I am looking for any way to get the font name used by default. That
> > way I can pass that back to elm code to reset the font back to
> > default/system/theme in ecrire. If/when a user decides they no longer
> > want the custom font.
> >
> > Essentially checking use default font, should revert back and stop
> > using their custom font. This works if  you close ecrire. I just need
> > it working with it running.
> >
> > You can see the settings dialog here, check box for Use Default Font.
> > https://phab.enlightenment.org/T5411
> >
> > I am open to any ideas, after chasing my tail and pulling hair! Thanks!
> >
> > --
> > William L. Thomson Jr.
> >
> > ------------------------------------------------------------
> > ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > enlightenment-devel mailing list
> > enlightenment-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
> >
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to