def set_syntax_highlighting(self, font_path, syntax_highlighting):
        """Perform syntax highlighting setups.

        Depends on the requested syntax highlighting,
        which might also be an empty string, meaning
        syntax highlighting must be disabled.

        Requesting the highlighting of a syntax which is
        not available has the same effect as passing an
        empty string.

        If syntax highlighting is enabled, we also attempt
        to highlight the text at this step. Check the
        update_syntax_highlight_data() and
        syntax_highlight_visible_lines() methods to see
        how this happens.

        Parameters
        ==========

        font_path (string)
            indicates the font style to be used when
            editing the contents; defaults to ENC_SANS_BOLD_FONT_PATH,
            which uses the normal font of the app; you can
            use FIRA_MONO_BOLD_FONT_PATH, to edit text in monospace font
            (to edit code for instance).
        syntax_highlighting (string)
            represents the name of a syntax used to
            highlight the text (for instance, 'python');
            if an empty string, or the name of an
            unsupported syntax is given, syntax highlighting
            is disabled;
            if, otherwise, the argument indicates a
            supported syntax, syntax highlighting is
            enabled and we use it to highlight the text
            when rendering it;
            even when the syntax highlight is enabled,
            though, the highlighting may fail, for instance,
            if there's a syntax error in the text; in such
            case, the text is rendered with no highlighting
            at all, but highlighting goes back to normal
            once the syntax problem is solved;
        """
        ### set syntax highlighting behaviour depending on
        ### requested syntax highlighting

        ### if a valid syntax is requested...

        if syntax_highlighting in AVAILABLE_SYNTAXES:

            ## define the default settings depending on the
            ## font style

            default_text_settings = (
                MONO_FONT_SETTINGS
                if font_path == FIRA_MONO_BOLD_FONT_PATH
                else SANS_FONT_SETTINGS
            )

            ## store a theme map ready for usage with the
            ## syntax name and default settings

            self.theme_map = get_ready_theme(syntax_highlighting, default_text_settings)

            ## store specific syntax mapping behaviour
            self.get_syntax_map = SYNTAX_TO_MAPPING_FUNCTION[syntax_highlighting]

            ## set routines so syntax highlighting is
            ## enabled

            self.syntax_highlighting_routine = self.check_syntax_highlighting

            self.edition_routine = self.mark_edition_time

            self.visible_lines_routine = self.syntax_highlight_visible_lines

            ### create a control variable to keep track of
            ### the time when the text was last edited
            self.last_edition_frame = 0

            ### map and apply the syntax highlighting in the
            ### text

            self.update_syntax_highlight_data()
            self.syntax_highlight_visible_lines()

            ### define foreground and background colors for
            ### the line numbers

            ## define text settings for the line numbers

            # reference the theme text settings locally
            theme_text_settings = self.theme_map["text_settings"]

            # if the line number settings from the theme
            # are available, use them
            try:
                lineno_settings = theme_text_settings["line_number"]

            # otherwise use the settings for normal text of
            # the theme for the line number settings

            except KeyError:

                lineno_settings = theme_text_settings["normal"]

            ## store the colors

            self.lineno_fg = lineno_settings["foreground_color"]

            self.lineno_bg = lineno_settings["background_color"]

            ### define the background color for the text
            self.background_color = self.theme_map["background_color"]

        ### otherwise, no syntax highlighting is applied,
        ### but other setups are needed

        else:

            ### we set routines so that no syntax
            ### highlighting is ever performed

            self.syntax_highlighting_routine = (
                self.edition_routine
            ) = self.visible_lines_routine = empty_function

            ### we define line number settings from the
            ### default text settings for monospaced text

            self.lineno_fg = MONO_FONT_SETTINGS["foreground_color"]

            self.lineno_bg = MONO_FONT_SETTINGS["background_color"]

            ### and also define the background color for
            ### the editing area

            self.background_color = (
                MONO_FONT_SETTINGS
                if font_path == FIRA_MONO_BOLD_FONT_PATH
                else SANS_FONT_SETTINGS
            )["background_color"]

        ### finally, define either black or white as the
        ### color for the cursor, whichever contrasts more
        ### with the current background color used
        self.cursor_color = get_contrasting_bw(self.background_color)
Perform syntax highlighting setups.

        Depends on the requested syntax highlighting,
        which might also be an empty string, meaning
        syntax highlighting must be disabled.

        Requesting the highlighting of a syntax which is
        not available has the same effect as passing an
        empty string.

        If syntax highlighting is enabled, we also attempt
        to highlight the text at this step. Check the
        update_syntax_highlight_data() and
        syntax_highlight_visible_lines() methods to see
        how this happens.

        Parameters
        ==========

        font_path (string)
            indicates the font style to be used when
            editing the contents; defaults to ENC_SANS_BOLD_FONT_PATH,
            which uses the normal font of the app; you can
            use FIRA_MONO_BOLD_FONT_PATH, to edit text in monospace font
            (to edit code for instance).
        syntax_highlighting (string)
            represents the name of a syntax used to
            highlight the text (for instance, 'python');
            if an empty string, or the name of an
            unsupported syntax is given, syntax highlighting
            is disabled;
            if, otherwise, the argument indicates a
            supported syntax, syntax highlighting is
            enabled and we use it to highlight the text
            when rendering it;
            even when the syntax highlight is enabled,
            though, the highlighting may fail, for instance,
            if there's a syntax error in the text; in such
            case, the text is rendered with no highlighting
            at all, but highlighting goes back to normal
            once the syntax problem is solved;
        
nodezator/textman/editor/cursor/syntaxhigh.py