Ensuring that a style is supported by a font family

Ensuring that a style is supported by a font family

' Not all fonts support the same styles. This function takes in ' input a font family and a font style, and returns a font style' which is safe for that particular font family, by removing' the styles that are not supported'' Example:'   GetSafeStyleForFontFamily(richTextBox1.SelectionFont.FontFamily,'  '     richTextBox1.SelectionFont.Style)Public Function GetSafeStyleForFontFamily(ByVal fontFam As FontFamily, _    ByVal style As FontStyle) As FontStyle    ' remove the styles not supported    If (style And FontStyle.Regular) = FontStyle.Regular Then        ' if the regular style is currently present, but not supported         ' by the new font family, remove it        If Not fontFam.IsStyleAvailable(FontStyle.Regular) Then            style = style And Not FontStyle.Regular        End If    End If    ' do the same for bold, italic and underline    If (style And FontStyle.Bold) = FontStyle.Bold Then        If Not fontFam.IsStyleAvailable(FontStyle.Bold) Then            style = style And Not FontStyle.Bold        End If    End If    If (style And FontStyle.Italic) = FontStyle.Italic Then        If Not fontFam.IsStyleAvailable(FontStyle.Italic) Then            style = style And Not FontStyle.Italic        End If    End If    If (style And FontStyle.Underline) = FontStyle.Underline Then        If Not fontFam.IsStyleAvailable(FontStyle.Underline) Then            style = style And Not FontStyle.Underline        End If    End If    If (style And FontStyle.Strikeout) = FontStyle.Strikeout Then        If Not fontFam.IsStyleAvailable(FontStyle.Strikeout) Then            style = style And Not FontStyle.Strikeout        End If    End If    Return styleEnd Function

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes