mod/maxgui.mod/fltkmaxgui.mod/src/Fl_Text_Display.cxx
int Fl_Text_Display::find_x(const char *s, int len, int style, int x) const {
  IS_UTF8_ALIGNED(s)

  // TODO: use binary search which may be quicker.
  int i = 0;
  while (i<len) {
    int cl = fl_utf8len(s[i]);
    int w = int( string_width(s, i+cl, style) );
    if (w>x) 
      return i;
    i += cl;
  }  
  return len;
}
/**
 \brief Finde the index of the charcter that lies at the given x position.
 \param s UTF-8 text string
 \param len length of string
 \param style index into style lookup table
 \param x position in pixels
 \return index into buffer
 */
\brief Finde the index of the charcter that lies at the given x position.
\ brief Finde the index of the charcter that lies at the given x position .
int Fl_Text_Display::find_x(const char *s, int len, int style, int x) const {
  IS_UTF8_ALIGNED(s)
  int i = 0;
  while (i<len) {
    int cl = fl_utf8len(s[i]);
    int w = int( string_width(s, i+cl, style) );
    if (w>x) 
      return i;
    i += cl;
  }  
  return len;
}
int Fl_Text_Display :: find_x ( const char * s , int len , int style , int x ) const { IS_UTF8_ALIGNED ( s ) int i = 0 ; while ( i < len ) { int cl = fl_utf8len ( s [ i ] ) ; int w = int ( string_width ( s , i + cl , style ) ) ; if ( w > x ) return i ; i += cl ; } return len ; }
\brief Finde the index of the charcter that lies at the given x position.
\ brief Finde the index of the charcter that lies at the given x position .
// TODO: use binary search which may be quicker.